1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* misc/ruby-electric.el: Avoid use of the interactive function

`self-insert-command` which fires `post-self-insert-hook` and
  `post-command-hook`, to make the ruby-electric commands work
  nicely with those minor modes that make use of them to do
  similar input assistance, such as electric-pair-mode,
  autopair-mode and smartparens-mode.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2013-09-26 07:50:19 +00:00
parent b18151cf53
commit 26f7f7da27
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,12 @@
Thu Sep 26 16:43:42 2013 Akinori MUSHA <knu@iDaemons.org>
* misc/ruby-electric.el: Avoid use of the interactive function
`self-insert-command` which fires `post-self-insert-hook` and
`post-command-hook`, to make the ruby-electric commands work
nicely with those minor modes that make use of them to do
similar input assistance, such as electric-pair-mode,
autopair-mode and smartparens-mode.
Thu Sep 26 16:24:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before

View file

@ -131,7 +131,7 @@ strings. Note that you must have Font Lock enabled."
(defun ruby-electric-space (arg)
(interactive "P")
(self-insert-command (prefix-numeric-value arg))
(insert (make-string (prefix-numeric-value arg) last-command-event))
(if (ruby-electric-space-can-be-expanded-p)
(save-excursion
(ruby-indent-line t)
@ -198,11 +198,11 @@ strings. Note that you must have Font Lock enabled."
((and
(null ,arg)
(ruby-electric-is-last-command-char-expandable-punct-p))
(self-insert-command 1)
(insert last-command-event)
,@body)
(t
(setq this-command 'self-insert-command)
(self-insert-command (prefix-numeric-value ,arg)))))
(insert (make-string (prefix-numeric-value ,arg) last-command-event)))))
(defun ruby-electric-curlies(arg)
(interactive "P")
@ -294,7 +294,7 @@ strings. Note that you must have Font Lock enabled."
(ruby-electric-cua-replace-region))
(arg
(setq this-command 'self-insert-command)
(self-insert-command (prefix-numeric-value arg)))
(insert (make-string (prefix-numeric-value arg) last-command-event)))
((and
(eq last-command 'ruby-electric-curlies)
(= last-command-event ?})) ;; {}