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

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

[elpa] externals/consult 8250b7a: consult-focus-lines: Uncover if input


From: ELPA Syncer
Subject: [elpa] externals/consult 8250b7a: consult-focus-lines: Uncover if input is empty
Date: Fri, 16 Jul 2021 07:57:08 -0400 (EDT)

branch: externals/consult
commit 8250b7ac9a0c2d4acb869df393bddb1070fd24cc
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult-focus-lines: Uncover if input is empty
    
    Add helpful prompt, make command more intuitive.
---
 consult.el | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/consult.el b/consult.el
index 9fd491d..656c73e 100644
--- a/consult.el
+++ b/consult.el
@@ -2746,14 +2746,18 @@ INITIAL is the initial input."
                   (setq li (cdr li) ov (cdr ov))))
               (setq last-input input)))))
       (when restore
-        (if (not input)
-            (goto-char point-orig)
+        (cond
+         ((not input)
+          (goto-char point-orig))
+         ((equal input "")
+          (consult-focus-lines 'show))
+         (t
           ;; Sucessfully terminated -> Remember invisible overlays
           (dolist (ov overlays)
             (if (overlay-get ov 'invisible)
                 (push ov consult--focus-lines-overlays)
               (delete-overlay ov)))
-          (setq overlays nil))
+          (setq overlays nil)))
         ;; Destroy remaining overlays
         (mapc #'delete-overlay overlays)))))
 
@@ -2764,8 +2768,9 @@ INITIAL is the initial input."
 The selected lines are shown and the other lines hidden. When called
 interactively, the lines selected are those that match the minibuffer input. In
 order to match the inverse of the input, prefix the input with `! '. With
-optional prefix argument SHOW reveal the hidden lines. When called from elisp,
-the filtering is performed by a FILTER function. This command obeys narrowing.
+optional prefix argument SHOW reveal the hidden lines. Alternatively the
+command can be restarted to reveal the lines. When called from elisp, the
+filtering is performed by a FILTER function. This command obeys narrowing.
 
 FILTER is the filter function.
 INITIAL is the initial input."
@@ -2775,14 +2780,18 @@ INITIAL is the initial input."
            ;; Use consult-location completion category when filtering lines
            (consult--completion-filter-dispatch
             pattern cands 'consult-location nil))))
-  (consult--forbid-minibuffer)
   (if show
       (progn
         (mapc #'delete-overlay consult--focus-lines-overlays)
-        (setq consult--focus-lines-overlays nil))
+        (setq consult--focus-lines-overlays nil)
+        (message "All lines revealed"))
+    (consult--forbid-minibuffer)
     (consult--with-increased-gc
      (consult--prompt
-      :prompt "Focus on lines: "
+      :prompt
+      (if consult--focus-lines-overlays
+          "Focus on lines (RET to reveal): "
+        "Focus on lines: ")
       :initial initial
       :history 'consult--keep-lines-history
       :state (consult--focus-lines-state filter)))))



reply via email to

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