summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-07 14:47:29 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-07 14:47:29 +0000
commitae8870e9e0a6bdd00709b661a3d4708f651e55f2 (patch)
treed5381cc92dbfeb635c7222866d72ede1c87d939c /misc
parent3bb86ae462ab411471f6f24d2cc967e0e9acdc84 (diff)
downloadruby-ae8870e9e0a6bdd00709b661a3d4708f651e55f2.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc')
-rw-r--r--misc/ruby-additional.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el
index 6ef10944f2..85cfdd8d90 100644
--- a/misc/ruby-additional.el
+++ b/misc/ruby-additional.el
@@ -7,11 +7,11 @@
(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 @@
(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 @@
(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)