emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pulsar 5e5796ecd5 02/10: Make pulsar--start also return


From: ELPA Syncer
Subject: [elpa] externals/pulsar 5e5796ecd5 02/10: Make pulsar--start also return point-min in the minibuffer
Date: Sat, 12 Aug 2023 03:58:37 -0400 (EDT)

branch: externals/pulsar
commit 5e5796ecd5e1944541c21e77ca3b21f0c752df15
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]