Pulse in multiple windows
Hello Prot, and thanks for this package and your work in general !
Something I noticed with pulsar : When two windows show the same buffer, switching from one to the other will pulse the line containing the point in both of them, which in my opinion defeats the purpose of the package. It would be nicer if only the line containing the point in the arriving window pulsed.
This is simple to reproduce : just having two adjacent windows with the *scratch*
buffer and switching between them suffices.
This is due to the way the pulse
library works, particularly the function pulse-momentary-highlight-region
, which creates an overlay and pulses it. Thankfully, it is possible to give properties to overlays, particularly the window property :
If the window property is non-nil, then the overlay applies only on that window.
Just setting the window property to the current window, as such :
(defun new/pulse-momentary-highlight-region (start end &optional face)
"Highlight between START and END, unhighlighting before next command.
Optional argument FACE specifies the face to do the highlighting."
(let ((o (make-overlay start end)))
;; Mark it for deletion
(overlay-put o 'pulse-delete t)
(overlay-put o 'window (frame-selected-window))
(pulse-momentary-highlight-overlay o face)))
Would achieve the desired result.
pulse
cannot be modified, though. The simplest course of action would be to add the above function to pulsar
(no extra dependencies, pulse
only uses C primitives), and modify your pulsar--pulse
function to use that one instead.
Let me know if you want me to provide the trivial PR, or if you have any questions.
Best,
Aymeric