From 30034b5536207c5a3fbc5ef8b8670cc74b96f382 Mon Sep 17 00:00:00 2001 From: knu Date: Sat, 18 May 2013 17:38:02 +0000 Subject: * 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 --- misc/ruby-electric.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'misc') 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 " -- cgit v1.2.3