branch: externals/pulsar commit fca0e538155226bc34703a9d24adc15515bb9b80 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Exert control over the pulse effect Without a non-nil value for 'pulse-flag' the pulsing does not work when Emacs is used in a server/client model. Instead, the current line remains highlighted until another command is invoked. By let-binding that variable, we ensure that we have control over the pulse effect. Thanks to kb, Petter Storvik, and Mark Barton for their feedback in issue 1: <https://gitlab.com/protesilaos/pulsar/-/issues/1>. --- README.org | 27 ++++++++++++++++++++++++--- pulsar.el | 16 +++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 07a1faab76..872d2e1a33 100644 --- a/README.org +++ b/README.org @@ -80,9 +80,16 @@ strongly encouraged to use ~customize-set-variable~ for the user option user option has a special custom setter function). #+vindex: pulsar-delay +#+vindex: pulsar-iterations #+vindex: pulsar-face -The duration of the highlight is determined by ~pulsar-delay~. While -the applicable face is specified in ~pulsar-face~. +The duration of the highlight is determined by ~pulsar-delay~. How +smooth the effect is depends on ~pulsar-iterations~. While the +applicable face is specified in ~pulsar-face~. + +#+vindex: pulsar-pulse +To disable the pulse but keep the highlight, set ~pulsar-pulse~ to nil. +The current line will remain highlighted until another command is +invoked. #+findex: pulsar-pulse-line To highlight the current line on demand, use the ~pulsar-pulse-line~ @@ -178,8 +185,10 @@ Remember to read the doc string of each of these variables. outline-previous-visible-heading outline-up-heading)) -(setq pulsar-face 'pulsar-magenta) +(setq pulsar-pulse t) (setq pulsar-delay 0.055) +(setq pulsar-iterations 10) +(setq pulsar-face 'pulsar-magenta) #+end_src * Integration with other packages @@ -213,6 +222,18 @@ Example use-cases: (add-hook 'imenu-after-jump-hook #'pulsar-reveal-entry) #+end_src +* Acknowledgements +:PROPERTIES: +:CUSTOM_ID: h:56577df6-49df-4204-bd85-d0c569b8edc0 +:END: +#+cindex: Contributors + +Pulsar is meant to be a collective effort. Every bit of help matters. + ++ Author/maintainer :: Protesilaos Stavrou. + ++ Ideas and user feedback :: Mark Barton, Petter Storvik, and user kb. + * GNU Free Documentation License :PROPERTIES: :APPENDIX: t diff --git a/pulsar.el b/pulsar.el index 4da1388f29..d84a2ff2c8 100644 --- a/pulsar.el +++ b/pulsar.el @@ -117,11 +117,23 @@ that has a background attribute." (face :tag "Other face (must have a background)")) :group 'pulsar) +(defcustom pulsar-pulse t + "When non-nil enable pulsing. +Otherwise the highlight stays on the current line until another +command is invoked." + :type 'boolean + :group 'pulsar) + (defcustom pulsar-delay 0.05 "Duration in seconds of the active pulse highlight." :type 'number :group 'pulsar) +(defcustom pulsar-iterations pulse-iterations + "Number of iterations in a pulse highlight." + :type 'number + :group 'pulsar) + ;;;; Faces (defgroup pulsar-faces () @@ -220,7 +232,9 @@ that has a background attribute." (defun pulsar-pulse-line () "Temporarily highlight the current line with optional FACE." (interactive) - (let ((pulse-delay pulsar-delay)) + (let ((pulse-flag pulsar-pulse) + (pulse-delay pulsar-delay) + (pulse-iterations pulsar-iterations)) (pulse-momentary-highlight-region (pulsar--start) (pulsar--end) pulsar-face))) ;;;; Advice setup