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

ruby-changes:31175

From: knu <ko1@a...>
Date: Fri, 11 Oct 2013 19:31:16 +0900 (JST)
Subject: [ruby-changes:31175] knu:r43254 (trunk): Import ruby-electric.el 2.0.1, a bug fix release.

knu	2013-10-11 19:31:03 +0900 (Fri, 11 Oct 2013)

  New Revision: 43254

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

  Log:
    Import ruby-electric.el 2.0.1, a bug fix release.
    
    * misc/ruby-electric.el: Import ruby-electric.el 2.0.1 which fixes
      a bug and a flaw with auto-end introduced in the revamp.
    
      * ruby-forward-sexp is inappropriate here because it moves the
        cursor past the keyword.
    
      * Fix a reversed looking-back check in
        ruby-electric--block-beg-keyword-at-point-p.
    
      * Do not add end again if space or return is hit repeatedly
        after a block beginning keyword.

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-electric.el
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43253)
+++ ChangeLog	(revision 43254)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Oct 11 19:27:22 2013  Akinori MUSHA  <knu@i...>
+
+	* misc/ruby-electric.el: Import ruby-electric.el 2.0.1 which fixes
+	  a bug and a flaw with auto-end introduced in the revamp.
+
+	  * ruby-forward-sexp is inappropriate here because it moves the
+	    cursor past the keyword.
+
+	  * Fix a reversed looking-back check in
+	    ruby-electric--block-beg-keyword-at-point-p.
+
+	  * Do not add end again if space or return is hit repeatedly
+	    after a block beginning keyword.
+
 Fri Oct 11 18:12:47 2013  Koichi Sasada  <ko1@a...>
 
 	* ext/objspace/gc_hook.c: prohibit reentrant.
Index: misc/ruby-electric.el
===================================================================
--- misc/ruby-electric.el	(revision 43253)
+++ misc/ruby-electric.el	(revision 43254)
@@ -10,7 +10,7 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L10
 ;; URL: https://github.com/knu/ruby-electric.el
 ;; Keywords: languages ruby
 ;; License: The same license terms as Ruby
-;; Version: 2.0
+;; Version: 2.0.1
 
 ;;; Commentary:
 ;;
@@ -79,15 +79,16 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L79
 (defun ruby-electric--modifier-keyword-at-point-p ()
   "Test if there is a modifier keyword at point."
   (and (looking-at ruby-modifier-beg-symbol-re)
-       (not (looking-back "\\."))
-       (save-excursion
-         (let ((indent1 (ruby-electric--try-insert-and-do "\n"
-                          (ruby-calculate-indent)))
-               (indent2 (save-excursion
-                          (ruby-forward-sexp 1)
-                          (ruby-electric--try-insert-and-do " x\n"
-                            (ruby-calculate-indent)))))
-           (= indent1 indent2)))))
+       (let ((end (match-end 1)))
+         (not (looking-back "\\."))
+         (save-excursion
+           (let ((indent1 (ruby-electric--try-insert-and-do "\n"
+                            (ruby-calculate-indent)))
+                 (indent2 (save-excursion
+                            (goto-char end)
+                            (ruby-electric--try-insert-and-do " x\n"
+                              (ruby-calculate-indent)))))
+             (= indent1 indent2))))))
 
 (defconst ruby-block-mid-symbol-re
   (regexp-opt ruby-block-mid-keywords 'symbols))
@@ -105,7 +106,7 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L106
   (and (looking-at ruby-block-beg-symbol-re)
        (if (string= (match-string 1) "do")
            (looking-back "\\s-")
-         (not (looking-back "[^.]")))
+         (not (looking-back "\\.")))
        ;; (not (ruby-electric--modifier-keyword-at-point-p)) ;; implicit assumption
        ))
 
@@ -157,7 +158,7 @@ cons, ACTION can be set to one of the fo https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L158
                    (setq keywords (cons keyword keywords)))))
            (setq ruby-electric-expandable-keyword-re
                  (concat (regexp-opt keywords 'symbols)
-                         "\\s-*$"))))
+                         "$"))))
   :group 'ruby-electric)
 
 (defcustom ruby-electric-simple-keywords-re nil
@@ -232,7 +233,7 @@ enabled." https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L233
        (setq sp-delayed-pair nil))
   (cond (arg
          (insert (make-string (prefix-numeric-value arg) last-command-event)))
-        ((ruby-electric-space-can-be-expanded-p)
+        ((ruby-electric-space/return-can-be-expanded-p)
          (let (action)
            (save-excursion
              (goto-char (match-beginning 0))
@@ -286,7 +287,7 @@ enabled." https://github.com/ruby/ruby/blob/trunk/misc/ruby-electric.el#L287
   (or (memq 'all ruby-electric-expand-delimiters-list)
       (memq char ruby-electric-expand-delimiters-list)))
 
-(defun ruby-electric-space-can-be-expanded-p()
+(defun ruby-electric-space/return-can-be-expanded-p()
   (and (ruby-electric-code-at-point-p)
        (looking-back ruby-electric-expandable-keyword-re)))
 

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

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