summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--misc/ruby-electric.el23
2 files changed, 19 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index c1801332f76..ad817cf688c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 17 19:18:24 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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 ?\".
+
Fri May 17 18:06:15 2013 Tanaka Akira <akr@fsij.org>
* configure.in: Consider error messages to find out version option of
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 1e43de4b5f0..25b9e5dbfa9 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")