mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* misc/ruby-electric.el (ruby-electric-matching-char): Make
electric quotes work again at the end of buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54fef60273
commit
30034b5536
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun May 19 02:27:21 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* misc/ruby-electric.el (ruby-electric-matching-char): Make
|
||||||
|
electric quotes work again at the end of buffer.
|
||||||
|
|
||||||
Sun May 19 01:39:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun May 19 01:39:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (setjmp-type): check if setjmpex() is really available.
|
* configure.in (setjmp-type): check if setjmpex() is really available.
|
||||||
|
|
|
@ -248,6 +248,17 @@ strings. Note that you must have Font Lock enabled."
|
||||||
(insert "{}")
|
(insert "{}")
|
||||||
(backward-char 1))))))
|
(backward-char 1))))))
|
||||||
|
|
||||||
|
(defmacro ruby-electric-avoid-eob(&rest body)
|
||||||
|
`(if (eobp)
|
||||||
|
(save-excursion
|
||||||
|
(insert "\n")
|
||||||
|
(backward-char)
|
||||||
|
,@body
|
||||||
|
(prog1
|
||||||
|
(ruby-electric-string-at-point-p)
|
||||||
|
(delete-char 1)))
|
||||||
|
,@body))
|
||||||
|
|
||||||
(defun ruby-electric-matching-char(arg)
|
(defun ruby-electric-matching-char(arg)
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(ruby-electric-insert
|
(ruby-electric-insert
|
||||||
|
@ -257,7 +268,9 @@ strings. Note that you must have Font Lock enabled."
|
||||||
(cond
|
(cond
|
||||||
((char-equal closing last-command-event)
|
((char-equal closing last-command-event)
|
||||||
(if (and (not (ruby-electric-string-at-point-p))
|
(if (and (not (ruby-electric-string-at-point-p))
|
||||||
(progn (redisplay) (ruby-electric-string-at-point-p)))
|
(ruby-electric-avoid-eob
|
||||||
|
(redisplay)
|
||||||
|
(ruby-electric-string-at-point-p)))
|
||||||
(save-excursion (insert closing))
|
(save-excursion (insert closing))
|
||||||
(and (eq last-command 'ruby-electric-matching-char)
|
(and (eq last-command 'ruby-electric-matching-char)
|
||||||
(char-equal (following-char) closing) ;; repeated ' or "
|
(char-equal (following-char) closing) ;; repeated ' or "
|
||||||
|
|
Loading…
Add table
Reference in a new issue