1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Add a command for redisplay during keyboard macros

* doc/emacs/kmacro.texi (Basic Keyboard Macro): Document it
(bug#39252).

* lisp/kmacro.el (kdb-macro-redisplay): New function.
(kmacro-keymap): Bind it.
This commit is contained in:
Marco Wahl 2021-01-29 08:01:12 +01:00 committed by Lars Ingebrigtsen
parent 1275dc4711
commit d4e9d191ae
3 changed files with 22 additions and 0 deletions

View File

@ -179,6 +179,14 @@ itself counts as the first repetition, since it is executed as you
define it, so @kbd{C-u 4 C-x )} executes the macro immediately 3
additional times.
@findex kdb-macro-redisplay
@kindex C-x C-k Q
While executing a long-running keyboard macro, it can sometimes be
useful to trigger a redisplay (to show how far we've gotten). The
@kbd{C-x C-k Q} can be used for this. As a not very useful example,
@kbd{C-x ( M-f C-x C-k Q C-x )} will create a macro that will
redisplay once per iteration when saying @kbd{C-u 42 C-x e}.
@node Keyboard Macro Ring
@section The Keyboard Macro Ring

View File

@ -1577,6 +1577,9 @@ This allows mode-specific alterations to how `thing-at-point' works.
** Miscellaneous
+++
*** New command `C-x C-k Q' to force redisplay in keyboard macros.
---
*** New user option 'remember-diary-regexp'.

View File

@ -172,6 +172,7 @@ macro to be executed before appending to it."
(define-key map "\C-k" 'kmacro-end-or-call-macro-repeat)
(define-key map "r" 'apply-macro-to-region-lines)
(define-key map "q" 'kbd-macro-query) ;; Like C-x q
(define-key map "Q" 'kdb-macro-redisplay)
;; macro ring
(define-key map "\C-n" 'kmacro-cycle-ring-next)
@ -1298,6 +1299,16 @@ To customize possible responses, change the \"bindings\" in
(kmacro-push-ring)
(setq last-kbd-macro kmacro-step-edit-new-macro))))
(defun kdb-macro-redisplay ()
"Force redisplay during kbd macro execution."
(interactive)
(or executing-kbd-macro
defining-kbd-macro
(user-error "Not defining or executing kbd macro"))
(when executing-kbd-macro
(let ((executing-kbd-macro nil))
(redisplay))))
(provide 'kmacro)
;;; kmacro.el ends here