diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-05-04 22:50:20 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-05-04 22:50:20 -0400 |
commit | df96ab1e0a29e4d178b1406ceacc70d5f9e5c2d6 (patch) | |
tree | 3508d5f0daa190d0bcbe3611a1e68eef06ee8605 /lisp/kmacro.el | |
parent | 5342bb062f39a387e9a770b3edef881ee4a72f17 (diff) | |
download | emacs-df96ab1e0a29e4d178b1406ceacc70d5f9e5c2d6.tar.gz |
Use set-temporary-overlay-map.
* lisp/repeat.el: Use lexical-binding.
(repeat-last-self-insert, repeat-num-input-keys-at-self-insert)
(repeat-undo-count): Remove.
(repeat):
* lisp/progmodes/octave-mod.el (octave-abbrev-start):
* lisp/progmodes/f90.el (f90-abbrev-start):
* lisp/face-remap.el (text-scale-adjust):
* lisp/kmacro.el (kmacro-call-macro): Use set-temporary-overlay-map.
Diffstat (limited to 'lisp/kmacro.el')
-rw-r--r-- | lisp/kmacro.el | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el index b715e44387e..ffc97085a69 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -625,8 +625,10 @@ for details on how to adjust or disable this behavior. To make a macro permanent so you can call it even after defining others, use \\[kmacro-name-last-macro]." (interactive "p") - (let ((repeat-key (and (null no-repeat) - (> (length (this-single-command-keys)) 1) + (let ((repeat-key (and (or (and (null no-repeat) + (> (length (this-single-command-keys)) 1)) + ;; Used when we're in the process of repeating. + (eq no-repeat 'repeating)) last-input-event)) repeat-key-str) (if end-macro @@ -640,24 +642,16 @@ others, use \\[kmacro-name-last-macro]." repeat-key kmacro-call-repeat-key))) (setq repeat-key-str (format-kbd-macro (vector repeat-key) nil)) - (while repeat-key - ;; Issue a hint to the user, if the echo area isn't in use. - (unless (current-message) - (message "(Type %s to repeat macro%s)" - repeat-key-str - (if (and kmacro-call-repeat-with-arg - arg (> arg 1)) - (format " %d times" arg) ""))) - (if (equal repeat-key (read-event)) - (progn - (clear-this-command-keys t) - (call-last-kbd-macro (and kmacro-call-repeat-with-arg arg) - #'kmacro-loop-setup-function) - (setq last-input-event nil)) - (setq repeat-key nil))) - (when last-input-event - (clear-this-command-keys t) - (setq unread-command-events (list last-input-event)))))) + ;; Can't use the `keep-pred' arg because this overlay keymap needs to be + ;; removed during the next run of the kmacro (i.e. we need to add&remove + ;; this overlay-map at each repetition). + (set-temporary-overlay-map + (let ((map (make-sparse-keymap))) + (define-key map (vector repeat-key) + `(lambda () (interactive) + (kmacro-call-macro ,(and kmacro-call-repeat-with-arg arg) + 'repeating))) + map))))) ;;; Combined function key bindings: |