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

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

[elpa] externals/vertico eb453b426d 2/2: Support vertico-count-format mo


From: ELPA Syncer
Subject: [elpa] externals/vertico eb453b426d 2/2: Support vertico-count-format modification in the current minibuffer
Date: Sun, 2 Jan 2022 13:57:47 -0500 (EST)

branch: externals/vertico
commit eb453b426dd5c8e6154006e7031c591162950fd5
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Support vertico-count-format modification in the current minibuffer
    
    (defun vertico-toggle-count ()
      (interactive)
      (setq-local vertico-count-format
                  (and (not vertico-count-format)
                       '("%-6s " . "%s/%s"))))
    (define-key vertico-map "\M-C" #'vertico-toggle-count)
    
    This is helpful for the implementation of an unobtrusive mode (See #168).
---
 vertico.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/vertico.el b/vertico.el
index c66be521e6..526fb2e144 100644
--- a/vertico.el
+++ b/vertico.el
@@ -580,11 +580,9 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and 
PRED."
 
 (defun vertico--display-count ()
   "Update count overlay `vertico--count-ov'."
-  (when vertico--count-ov
-    (move-overlay vertico--count-ov (point-min) (point-min))
-    ;; Set priority for compatibility with `minibuffer-depth-indicate-mode'
-    (overlay-put vertico--count-ov 'priority 1)
-    (overlay-put vertico--count-ov 'before-string (vertico--format-count))))
+  (move-overlay vertico--count-ov (point-min) (point-min))
+  (overlay-put vertico--count-ov 'before-string
+               (if vertico-count-format (vertico--format-count) "")))
 
 (defun vertico--prompt-selection ()
   "Highlight the prompt if selected."
@@ -750,8 +748,9 @@ When the prefix argument is 0, the group order is reset."
   "Setup completion UI."
   (setq vertico--input t
         vertico--candidates-ov (make-overlay (point-max) (point-max) nil t t)
-        vertico--count-ov (and vertico-count-format
-                               (make-overlay (point-min) (point-min) nil t t)))
+        vertico--count-ov (make-overlay (point-min) (point-min) nil t t))
+  ;; Set priority for compatibility with `minibuffer-depth-indicate-mode'
+  (overlay-put vertico--count-ov 'priority 1)
   (setq-local completion-auto-help nil
               completion-show-inline-help nil)
   (use-local-map vertico-map)



reply via email to

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