[前][次][番号順一覧][スレッド一覧]

ruby-changes:28745

From: knu <ko1@a...>
Date: Fri, 17 May 2013 19:27:42 +0900 (JST)
Subject: [ruby-changes:28745] knu:r40797 (trunk): * misc/ruby-electric.el (ruby-electric-matching-char): Do not put

knu	2013-05-17 19:27:32 +0900 (Fri, 17 May 2013)

  New Revision: 40797

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40797

  Log:
    * misc/ruby-electric.el (ruby-electric-matching-char): Do not put
      a closing quote when the quote typed does not start a string, as
      in $', ?\' or ?\".

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-electric.el

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40796)
+++ ChangeLog	(revision 40797)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May 17 19:18:24 2013  Akinori MUSHA  <knu@i...>
+
+	* misc/ruby-electric.el (ruby-electric-matching-char): Do not put
+	  a closing quote when the quote typed does not start a string, as
+	  in $', ?\' or ?\".
+
 Fri May 17 18:06:15 2013  Tanaka Akira  <akr@f...>
 
 	* configure.in: Consider error messages to find out version option of
Index: misc/ruby-electric.el
===================================================================
--- misc/ruby-electric.el	(revision 40796)
+++ misc/ruby-electric.el	(revision 40797)
@@ -252,16 +252,19 @@ strings. Note that you must have Font Lo https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L252
   (interactive "P")
   (ruby-electric-insert
    arg
-   (cond
-    ((and
-      (eq last-command 'ruby-electric-matching-char)
-      (char-equal last-command-event (following-char))) ;; repeated ' or "
-     (setq this-command 'self-insert-command)
-     (delete-forward-char 1))
-    (t
-     (and (ruby-electric-code-at-point-p)
-          (save-excursion (insert (cdr (assoc last-command-event
-                                              ruby-electric-matching-delimeter-alist)))))))))
+   (let ((closing (cdr (assoc last-command-event
+                              ruby-electric-matching-delimeter-alist))))
+     (cond
+      ((char-equal closing last-command-event)
+       (if (and (not (ruby-electric-string-at-point-p))
+                (progn (redisplay) (ruby-electric-string-at-point-p)))
+           (save-excursion (insert closing))
+         (and (eq last-command 'ruby-electric-matching-char)
+              (char-equal (following-char) closing) ;; repeated ' or "
+              (delete-forward-char 1))
+         (setq this-command 'self-insert-command)))
+      ((ruby-electric-code-at-point-p)
+       (save-excursion (insert closing)))))))
 
 (defun ruby-electric-closing-char(arg)
   (interactive "P")

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]