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

ruby-changes:31110

From: knu <ko1@a...>
Date: Tue, 8 Oct 2013 04:29:48 +0900 (JST)
Subject: [ruby-changes:31110] knu:r43189 (trunk): * misc/ruby-mode.el: Use preceding-char/following-char

knu	2013-10-08 04:29:41 +0900 (Tue, 08 Oct 2013)

  New Revision: 43189

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

  Log:
    * misc/ruby-mode.el: Use preceding-char/following-char
      (returning 0 at BOF/EOF) instead of char-before/char-after
      (returning nil at BOF/EOF) to avoid error from char-syntax when
      at BOF/EOF.

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-mode.el
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43188)
+++ ChangeLog	(revision 43189)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Oct  8 04:28:25 2013  Akinori MUSHA  <knu@i...>
+
+	* misc/ruby-mode.el: Use preceding-char/following-char
+	  (returning 0 at BOF/EOF) instead of char-before/char-after
+	  (returning nil at BOF/EOF) to avoid error from char-syntax when
+	  at BOF/EOF.
+
 Tue Oct  8 04:12:45 2013  Akinori MUSHA  <knu@i...>
 
 	* misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 43188)
+++ misc/ruby-mode.el	(revision 43189)
@@ -448,7 +448,7 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L448
        ((progn
           (forward-char -1)
           (and (looking-at "\\?")
-               (or (eq (char-syntax (char-before (point))) ?w)
+               (or (eq (char-syntax (preceging-char)) ?w)
                    (ruby-special-char-p))))
         nil)
        ((and (eq option 'heredoc) (< space 0))
@@ -1201,14 +1201,14 @@ balanced expression is found." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L1201
     (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
       (when (eq (char-before) ?\})
 	(delete-char -1)
-	(if (eq (char-syntax (char-before)) ?w)
+	(if (eq (char-syntax (preceding-char)) ?w)
 	    (insert " "))
 	(insert "end")
-	(if (eq (char-syntax (char-after)) ?w)
+	(if (eq (char-syntax (following-char)) ?w)
 	    (insert " "))
 	(goto-char orig)
 	(delete-char 1)
-	(if (eq (char-syntax (char-before)) ?w)
+	(if (eq (char-syntax (preceding-char)) ?w)
 	    (insert " "))
 	(insert "do")
 	(when (looking-at "\\sw\\||")
@@ -1218,7 +1218,7 @@ balanced expression is found." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L1218
 
 (defun ruby-do-end-to-brace ()
   (when (and (or (bolp)
-		 (not (memq (char-syntax (char-before)) '(?w ?_))))
+		 (not (memq (char-syntax (preceding-char)) '(?w ?_))))
 	     (looking-at "\\<do\\(\\s \\|$\\)"))
     (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
       (backward-char 3)

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

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