branch: externals/pulsar commit 5e5796ecd5e1944541c21e77ca3b21f0c752df15 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make pulsar--start also return point-min in the minibuffer The idea is to set up something like the following and have it produce a pulse over the text of the prompt: (add-hook 'minibuffer-setup-hook 'pulsar-pulse-line-blue) --- pulsar.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pulsar.el b/pulsar.el index 4fe5195d57..2ce177bd9f 100644 --- a/pulsar.el +++ b/pulsar.el @@ -252,10 +252,18 @@ pulse. Only applies when `pulsar-pulse' is non-nil." (or (eobp) (eq (point) (point-max))))) (defun pulsar--start () - "Return appropriate line start." - (if (and (pulsar--buffer-end-p) (eq (char-before) ?\n)) - (line-beginning-position 0) - (line-beginning-position))) + "Return appropriate line start. +When in the minibuffer, return the `point-min', which includes +the text of the prompt. This way, a pulse will be visible even +if the minibuffer has no initial text (e.g. `M-x' with the +default completion setup)." + (cond + ((minibufferp) + (point-min)) + ((and (pulsar--buffer-end-p) (eq (char-before) ?\n)) + (line-beginning-position 0)) + (t + (line-beginning-position)))) (defun pulsar--end () "Return appropriate line end."