mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
3bb86ae462
commit
ae8870e9e0
2 changed files with 14 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Oct 7 22:52:16 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* cont.c (FIBER_USE_NATIVE): split long conditions.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue