mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
593855a0ff
commit
20eff9bd7c
2 changed files with 12 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Tue Oct 8 04:28:25 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* 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@iDaemons.org>
|
Tue Oct 8 04:12:45 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
|
* misc/ruby-additional.el (ruby-mode-set-encoding): Add a missing
|
||||||
|
|
|
@ -448,7 +448,7 @@ Emacs to Ruby."
|
||||||
((progn
|
((progn
|
||||||
(forward-char -1)
|
(forward-char -1)
|
||||||
(and (looking-at "\\?")
|
(and (looking-at "\\?")
|
||||||
(or (eq (char-syntax (char-before (point))) ?w)
|
(or (eq (char-syntax (preceging-char)) ?w)
|
||||||
(ruby-special-char-p))))
|
(ruby-special-char-p))))
|
||||||
nil)
|
nil)
|
||||||
((and (eq option 'heredoc) (< space 0))
|
((and (eq option 'heredoc) (< space 0))
|
||||||
|
@ -1201,14 +1201,14 @@ balanced expression is found."
|
||||||
(let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
|
(let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
|
||||||
(when (eq (char-before) ?\})
|
(when (eq (char-before) ?\})
|
||||||
(delete-char -1)
|
(delete-char -1)
|
||||||
(if (eq (char-syntax (char-before)) ?w)
|
(if (eq (char-syntax (preceding-char)) ?w)
|
||||||
(insert " "))
|
(insert " "))
|
||||||
(insert "end")
|
(insert "end")
|
||||||
(if (eq (char-syntax (char-after)) ?w)
|
(if (eq (char-syntax (following-char)) ?w)
|
||||||
(insert " "))
|
(insert " "))
|
||||||
(goto-char orig)
|
(goto-char orig)
|
||||||
(delete-char 1)
|
(delete-char 1)
|
||||||
(if (eq (char-syntax (char-before)) ?w)
|
(if (eq (char-syntax (preceding-char)) ?w)
|
||||||
(insert " "))
|
(insert " "))
|
||||||
(insert "do")
|
(insert "do")
|
||||||
(when (looking-at "\\sw\\||")
|
(when (looking-at "\\sw\\||")
|
||||||
|
@ -1218,7 +1218,7 @@ balanced expression is found."
|
||||||
|
|
||||||
(defun ruby-do-end-to-brace ()
|
(defun ruby-do-end-to-brace ()
|
||||||
(when (and (or (bolp)
|
(when (and (or (bolp)
|
||||||
(not (memq (char-syntax (char-before)) '(?w ?_))))
|
(not (memq (char-syntax (preceding-char)) '(?w ?_))))
|
||||||
(looking-at "\\<do\\(\\s \\|$\\)"))
|
(looking-at "\\<do\\(\\s \\|$\\)"))
|
||||||
(let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
|
(let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
|
||||||
(backward-char 3)
|
(backward-char 3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue