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

ruby-changes:31103

From: knu <ko1@a...>
Date: Mon, 7 Oct 2013 23:47:53 +0900 (JST)
Subject: [ruby-changes:31103] knu:r43182 (trunk): * misc/ruby-additional.el: Use preceding-char/following-char

knu	2013-10-07 23:47:29 +0900 (Mon, 07 Oct 2013)

  New Revision: 43182

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

  Log:
    * misc/ruby-additional.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-additional.el
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43181)
+++ ChangeLog	(revision 43182)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Oct  7 22:52:16 2013  Akinori MUSHA  <knu@i...>
+
+	* misc/ruby-additional.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.
+
 Mon Oct  7 22:45:20 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* cont.c (FIBER_USE_NATIVE): split long conditions.
Index: misc/ruby-additional.el
===================================================================
--- misc/ruby-additional.el	(revision 43181)
+++ misc/ruby-additional.el	(revision 43182)
@@ -7,11 +7,11 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L7
 
      (defun ruby-insert-end ()
        (interactive)
-       (if (eq (char-syntax (char-before)) ?w)
+       (if (eq (char-syntax (preceding-char)) ?w)
            (insert " "))
        (insert "end")
        (save-excursion
-         (if (eq (char-syntax (char-after)) ?w)
+         (if (eq (char-syntax (following-char)) ?w)
              (insert " "))
          (ruby-indent-line t)
          (end-of-line)))
@@ -19,16 +19,16 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L19
      (defun ruby-brace-to-do-end ()
        (when (looking-at "{")
          (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
-           (when (eq (char-before) ?\})
+           (when (eq (preceding-char) ?\})
              (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\\||")
@@ -38,7 +38,7 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L38
 
      (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/

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