Commit 6cce972f0e96

Vincent Demeester <vincent@sbr.pm>
2020-12-21 11:37:52
tools/emacs: pulse on paste
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent c6d677a
Changed files (1)
tools
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)