commit b985e743f2086c2e49c8f98cfa88f7282dbf5cea parent ba713a2464a5016c40029d00f3d7b5f74e76d0bc Author: Wojciech Siewierski <wojciech@siewierski.eu> Date: Fri, 3 Mar 2023 15:59:01 +0100 Add kmacro-x-mc-atomic-undo-mode Diffstat:
| M | kmacro-x-mc.el | | | 18 | ++++++++++++++---- |
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/kmacro-x-mc.el b/kmacro-x-mc.el @@ -155,10 +155,6 @@ See `kmacro-x-mc-mark-next' for the details." (run-hooks 'kmacro-x-mc-post-apply-hook) (kmacro-x-mc-mode 0)) -;; Always treat the bulk macro application as a single undo operation. -(advice-add #'kmacro-x-mc-apply :around - #'kmacro-x-undo-amalgamate-advice) - (defun kmacro-x-mc-quit () "Cancel the macro recording, disable `kmacro-x-mc-mode'. @@ -228,5 +224,19 @@ omitted from the recorded macro to prevent premature termination." (kill-local-variable 'kmacro-x-mc-offsets) (kill-local-variable 'kmacro-x-mc-cursors))) +(define-minor-mode kmacro-x-mc-atomic-undo-mode + "Undo the whole `kmacro-x-mc-mode' bulk operation at once. + +Note: The original actions used for the macro recording are not +undone, only the the macro executions (called from +`kmacro-x-mc-apply')." + :global t + :require 'kmacro-x-mc + (if kmacro-x-mc-atomic-undo-mode + (advice-add #'kmacro-x-mc-apply :around + #'kmacro-x-undo-amalgamate-advice) + (advice-remove #'kmacro-x-mc-apply + #'kmacro-x-undo-amalgamate-advice))) + (provide 'kmacro-x-mc) ;;; kmacro-x-mc.el ends here