kmacro-x

a fork of vifon's kmacro-x
git clone https://git.trogloxene.org/kmacro-x.git
Log | Files | Refs | README | LICENSE

commit 1721963b4de5096fcedcb9cff4635a8834c6b6f8
parent b332bdca068b7466c7412f5e7dec2d0c648804a2
Author: Wojciech Siewierski <wojciech@siewierski.eu>
Date:   Wed,  8 Mar 2023 13:41:43 +0100

Don't set defining-kbd-macro anymore, use macro appending instead

This should be less risky, considering how much the docs discourage
setting this variable by hand.  The behavior should stay exactly
the same.

Diffstat:
Mkmacro-x-mc-extra.el | 27++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/kmacro-x-mc-extra.el b/kmacro-x-mc-extra.el @@ -75,31 +75,24 @@ Some code borrowed from `mc/toggle-cursor-on-click'." (rectangle-mark-mode 1)) (rectangle-next-line))) - +;;;###autoload (defun kmacro-x-mc-pause () - "Pause the macro recording to allow free movement." + "Pause the macro recording to allow free movement. + +Intended to be bound to `C-v' in `kmacro-x-mc-mode-map', calls +`scroll-up-command' when the macro is already paused." (interactive) (if defining-kbd-macro (progn (cancel-kbd-macro-events) (save-excursion - ;; The docs say to not set `defining-kbd-macro', so let's do - ;; exactly this. I believe setting it from nil to t would be bad, - ;; but setting it from t to nil should be just enough to pause the - ;; macro recording. From a cursory research, Magit sets it to nil - ;; manually too, so we should be fine. - (let ((defining-kbd-macro nil)) - (message "%s" (substitute-command-keys - "Macro recording paused, press \ + (end-kbd-macro) + (message "%s" (substitute-command-keys + "Macro recording paused, press \ `\\[exit-recursive-edit]' to exit recursive edit")) - (recursive-edit)))) + (recursive-edit) + (start-kbd-macro 'append 'no-exec))) (call-interactively #'scroll-up-command))) -;;;###autoload -(defun kmacro-x-mc-enable-pause () - "Bind the experimental pause functionality." - (interactive) - (define-key kmacro-x-mc-mode-map (kbd "C-v") #'kmacro-x-mc-pause)) - (provide 'kmacro-x-mc-extra) ;;; kmacro-x-mc-extra.el ends here