kmacro-x

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

commit 2bbf2a799d6c019dddcc8989b96782f62a18b689
parent 327bde2d3211ae10bc8ecad21ae801d4a5087c41
Author: Wojciech Siewierski <wojciech@siewierski.eu>
Date:   Fri,  3 Mar 2023 03:00:46 +0100

Add hooks for custom actions

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

diff --git a/kmacro-x-mc.el b/kmacro-x-mc.el @@ -40,6 +40,14 @@ '((t (:underline t))) "The face used for the original cursor when using `kmacro-x-mc-mode'.") +(defcustom kmacro-x-mc-pre-apply-hook nil + "Functions to run before applying the recorded keyboard macro to cursors." + :type 'hook) + +(defcustom kmacro-x-mc-post-apply-hook nil + "Functions to run after applying the recorded keyboard macro to cursors." + :type 'hook) + (defvar-local kmacro-x-mc-regexp nil "A regexp matching the intended cursor positions.") @@ -113,6 +121,7 @@ necessary initialization." "Apply the recoded macro for each cursor." (interactive) (end-kbd-macro) + (run-hooks 'kmacro-x-mc-pre-apply-hook) (dolist (ov kmacro-x-mc-cursors) (unless (eq (overlay-get ov 'face) 'kmacro-x-mc-main-cursor-face) (goto-char (+ (overlay-start ov) @@ -120,6 +129,7 @@ necessary initialization." (push-mark (+ (overlay-start ov) (cdr (overlay-get ov 'offsets)))) (call-last-kbd-macro))) + (run-hooks 'kmacro-x-mc-post-apply-hook) (kmacro-x-mc-mode 0)) ;; Always treat the bulk macro application as a single undo operation.