commit 2c69574f80c328706119227788dbb5bb31c8672b
parent da76f841776c26f59e31ab17bc942a0b34a18292
Author: Wojciech Siewierski <wojciech@siewierski.eu>
Date: Thu, 13 Apr 2023 01:33:37 +0200
Experimental: live preview with modification-hooks
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/kmacro-x-mc.el b/kmacro-x-mc.el
@@ -214,6 +214,7 @@ argument behavior."
"Apply the recorded macro to CURSOR (from `kmacro-x-mc-cursors').
CURSOR is internally an overlay."
+ (overlay-put cursor 'display nil)
(goto-char (+ (overlay-start cursor)
(car (overlay-get cursor 'offsets))))
(push-mark (+ (overlay-start cursor)
@@ -324,6 +325,15 @@ user directory.
(car bounds))
(- (mark)
(car bounds))))
+ (overlay-put ov 'modification-hooks
+ (list
+ (lambda (main-cursor after-p _beg _end &optional _length)
+ (when after-p
+ (dolist (cursor kmacro-x-mc-cursors)
+ (unless (kmacro-x-mc--main-cursor-p cursor)
+ (overlay-put cursor 'display
+ (buffer-substring (overlay-start main-cursor)
+ (overlay-end main-cursor)))))))))
(setq-local kmacro-x-mc-main-cursor ov)
(setq-local kmacro-x-mc-cursors (list ov)))