diff options
| author | Marco Wahl | 2021-01-29 08:01:12 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-01-29 08:01:12 +0100 |
| commit | d4e9d191aeba9076db06857a90649f6fcddc7f3b (patch) | |
| tree | 6a95d2ac53d149920ce4e2a900d42829074d3a29 | |
| parent | 1275dc4711af77c9c223063dcd149d782d497463 (diff) | |
| download | emacs-d4e9d191aeba9076db06857a90649f6fcddc7f3b.tar.gz emacs-d4e9d191aeba9076db06857a90649f6fcddc7f3b.zip | |
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.
| -rw-r--r-- | doc/emacs/kmacro.texi | 8 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/kmacro.el | 11 |
3 files changed, 22 insertions, 0 deletions
diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi index adb2ab8d561..e713c6ef8c0 100644 --- a/doc/emacs/kmacro.texi +++ b/doc/emacs/kmacro.texi | |||
| @@ -179,6 +179,14 @@ itself counts as the first repetition, since it is executed as you | |||
| 179 | define it, so @kbd{C-u 4 C-x )} executes the macro immediately 3 | 179 | define it, so @kbd{C-u 4 C-x )} executes the macro immediately 3 |
| 180 | additional times. | 180 | additional times. |
| 181 | 181 | ||
| 182 | @findex kdb-macro-redisplay | ||
| 183 | @kindex C-x C-k Q | ||
| 184 | While executing a long-running keyboard macro, it can sometimes be | ||
| 185 | useful to trigger a redisplay (to show how far we've gotten). The | ||
| 186 | @kbd{C-x C-k Q} can be used for this. As a not very useful example, | ||
| 187 | @kbd{C-x ( M-f C-x C-k Q C-x )} will create a macro that will | ||
| 188 | redisplay once per iteration when saying @kbd{C-u 42 C-x e}. | ||
| 189 | |||
| 182 | @node Keyboard Macro Ring | 190 | @node Keyboard Macro Ring |
| 183 | @section The Keyboard Macro Ring | 191 | @section The Keyboard Macro Ring |
| 184 | 192 | ||
| @@ -1577,6 +1577,9 @@ This allows mode-specific alterations to how `thing-at-point' works. | |||
| 1577 | 1577 | ||
| 1578 | ** Miscellaneous | 1578 | ** Miscellaneous |
| 1579 | 1579 | ||
| 1580 | +++ | ||
| 1581 | *** New command `C-x C-k Q' to force redisplay in keyboard macros. | ||
| 1582 | |||
| 1580 | --- | 1583 | --- |
| 1581 | *** New user option 'remember-diary-regexp'. | 1584 | *** New user option 'remember-diary-regexp'. |
| 1582 | 1585 | ||
diff --git a/lisp/kmacro.el b/lisp/kmacro.el index bb8dacf4f48..303f38a59b6 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el | |||
| @@ -172,6 +172,7 @@ macro to be executed before appending to it." | |||
| 172 | (define-key map "\C-k" 'kmacro-end-or-call-macro-repeat) | 172 | (define-key map "\C-k" 'kmacro-end-or-call-macro-repeat) |
| 173 | (define-key map "r" 'apply-macro-to-region-lines) | 173 | (define-key map "r" 'apply-macro-to-region-lines) |
| 174 | (define-key map "q" 'kbd-macro-query) ;; Like C-x q | 174 | (define-key map "q" 'kbd-macro-query) ;; Like C-x q |
| 175 | (define-key map "Q" 'kdb-macro-redisplay) | ||
| 175 | 176 | ||
| 176 | ;; macro ring | 177 | ;; macro ring |
| 177 | (define-key map "\C-n" 'kmacro-cycle-ring-next) | 178 | (define-key map "\C-n" 'kmacro-cycle-ring-next) |
| @@ -1298,6 +1299,16 @@ To customize possible responses, change the \"bindings\" in | |||
| 1298 | (kmacro-push-ring) | 1299 | (kmacro-push-ring) |
| 1299 | (setq last-kbd-macro kmacro-step-edit-new-macro)))) | 1300 | (setq last-kbd-macro kmacro-step-edit-new-macro)))) |
| 1300 | 1301 | ||
| 1302 | (defun kdb-macro-redisplay () | ||
| 1303 | "Force redisplay during kbd macro execution." | ||
| 1304 | (interactive) | ||
| 1305 | (or executing-kbd-macro | ||
| 1306 | defining-kbd-macro | ||
| 1307 | (user-error "Not defining or executing kbd macro")) | ||
| 1308 | (when executing-kbd-macro | ||
| 1309 | (let ((executing-kbd-macro nil)) | ||
| 1310 | (redisplay)))) | ||
| 1311 | |||
| 1301 | (provide 'kmacro) | 1312 | (provide 'kmacro) |
| 1302 | 1313 | ||
| 1303 | ;;; kmacro.el ends here | 1314 | ;;; kmacro.el ends here |