* 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
This commit is contained in:
knu 2013-05-17 10:27:32 +00:00
Родитель fbe45fdfa2
Коммит 53fa01d060
2 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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")