summaryrefslogtreecommitdiff
path: root/misc/ruby-electric.el
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-18 17:38:02 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-18 17:38:02 +0000
commit30034b5536207c5a3fbc5ef8b8670cc74b96f382 (patch)
treeb1ae0809c46c0f41dbe8f72a4a1892927164cde6 /misc/ruby-electric.el
parent54fef60273af8fa1173aa84cf7fe434893695435 (diff)
* 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
Diffstat (limited to 'misc/ruby-electric.el')
-rw-r--r--misc/ruby-electric.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 25b9e5d..ce2ac15 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 "