commit 6cce972f0e96d6b85f3bacaebb7f353f06d9c38f parent c6d677a379164662b20f33cbe1aa17c7cc514c38 Author: Vincent Demeester <vincent@sbr.pm> Date: Mon, 21 Dec 2020 11:37:52 +0100 tools/emacs: pulse on paste Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-navigating.el | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-navigating.el b/tools/emacs/config/config-navigating.el @@ -185,6 +185,18 @@ without the `:extend' property.") face 'vde/pulse-line-modus-theme))) (pulse-momentary-highlight-region start end face))) + (defun ct/yank-pulse-advice (orig-fn &rest args) + ;; Define the variables first + (let (begin end) + ;; Initialize `begin` to the current point before pasting + (setq begin (point)) + ;; Forward to the decorated function (i.e. `yank`) + (apply orig-fn args) + ;; Initialize `end` to the current point after pasting + (setq end (point)) + ;; Pulse to highlight! + (pulse-momentary-highlight-region begin end))) + (advice-add 'yank :around #'ct/yank-pulse-advice) :bind ("<C-escape>" . vde/pulse-line)) (provide 'config-navigating)