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
** Miscellaneous
++++
+*** New command `C-x C-k Q' to force redisplay in keyboard macros.
+
---
*** New user option 'remember-diary-regexp'.
(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)
(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