summaryrefslogtreecommitdiff
path: root/misc/ruby-electric.el
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-17 10:27:32 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-17 10:27:32 +0000
commit53fa01d0608d82fc6edffe59ade5d081d7138c8e (patch)
tree5fd27db1cfe46a06a144b859d22779627cee52b1 /misc/ruby-electric.el
parentfbe45fdfa2a3dd461adfe82e13e97c7717b34dca (diff)
* misc/ruby-electric.el (ruby-electric-matching-char): Do not put
a closing quote when the quote typed does not start a string, as in $', ?\' or ?\". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc/ruby-electric.el')
-rw-r--r--misc/ruby-electric.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 1e43de4..25b9e5d 100644
--- a/misc/ruby-electric.el
+++ b/misc/ruby-electric.el
@@ -252,16 +252,19 @@ strings. Note that you must have Font Lock enabled."
(interactive "P")
(ruby-electric-insert
arg
- (cond
- ((and
- (eq last-command 'ruby-electric-matching-char)
- (char-equal last-command-event (following-char))) ;; repeated ' or "
- (setq this-command 'self-insert-command)
- (delete-forward-char 1))
- (t
- (and (ruby-electric-code-at-point-p)
- (save-excursion (insert (cdr (assoc last-command-event
- ruby-electric-matching-delimeter-alist)))))))))
+ (let ((closing (cdr (assoc last-command-event
+ ruby-electric-matching-delimeter-alist))))
+ (cond
+ ((char-equal closing last-command-event)
+ (if (and (not (ruby-electric-string-at-point-p))
+ (progn (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 "
+ (delete-forward-char 1))
+ (setq this-command 'self-insert-command)))
+ ((ruby-electric-code-at-point-p)
+ (save-excursion (insert closing)))))))
(defun ruby-electric-closing-char(arg)
(interactive "P")