diff --git a/ChangeLog b/ChangeLog index b05483c3ed..0861841a02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun May 19 02:27:21 2013 Akinori MUSHA + + * 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 * configure.in (setjmp-type): check if setjmpex() is really available. diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el index 25b9e5dbfa..ce2ac15ef7 100644 --- a/misc/ruby-electric.el +++ b/misc/ruby-electric.el @@ -248,6 +248,17 @@ strings. Note that you must have Font Lock enabled." (insert "{}") (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) (interactive "P") (ruby-electric-insert @@ -257,7 +268,9 @@ strings. Note that you must have Font Lock enabled." (cond ((char-equal closing last-command-event) (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)) (and (eq last-command 'ruby-electric-matching-char) (char-equal (following-char) closing) ;; repeated ' or "