branch: externals/pulsar commit 467b0205acca815ee1f83a7208c0cac9e71ae3b7 Author: Bahman Movaqar <bah...@bahmanm.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
pulse the active region. if there are no regions, do nothing. in case there are multiple active regions, it `pulsar-pulse-region` only works w/ the first (topmost) region. --- pulsar.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pulsar.el b/pulsar.el index 54b7f0fa8e..06affcb141 100644 --- a/pulsar.el +++ b/pulsar.el @@ -311,6 +311,21 @@ pulse effect." (interactive) (pulsar--pulse)) +;;;###autoload +(defun pulsar-pulse-region () + "Temporarily highlight the active region if any. Do nothing otherwise. +When `pulsar-pulse' is non-nil (the default) make the highlight +pulse before fading away. The pulse effect is controlled by +`pulsar-delay' and `pulsar-iterations'. + +NB: If multiple regions are active, only the first one is impacted." + (interactive) + (when (region-active-p) + (let* ((bounds (region-bounds)) + (region-start (caar bounds)) + (region-end (cdar bounds))) + (pulsar--pulse nil nil region-start region-end)))) + ;;;###autoload (defun pulsar-highlight-line () "Temporarily highlight the current line.