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

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

[elpa] master 25e1444 257/272: ivy.el (ivy-use-ignore-default): New defc


From: Oleh Krehel
Subject: [elpa] master 25e1444 257/272: ivy.el (ivy-use-ignore-default): New defcustom
Date: Mon, 25 Apr 2016 10:13:29 +0000

branch: master
commit 25e1444f0a129f1357419cbb4ed1cdf7f51ceb7d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy-use-ignore-default): New defcustom
    
    * ivy.el (ivy-use-ignore): Is now set to `ivy-use-ignore-default'.
    (ivy-toggle-ignore): Update.
    (ivy--reset-state): Update.
    (ivy--switch-buffer-matcher): When `ivy-use-ignore' is t, and they
    only cands that match the input also match `ivy-ignore-buffers' show
    them anyway. But when `ivy-use-ignore' is 'always, show nothing in that
    case.
    
    Fixes #477
---
 ivy.el |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 674e487..e3e05b7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -359,8 +359,17 @@ sources. These values will subsequently be filtered on 
`ivy-text'.
 
 This variable is set by `ivy-read' and used by `ivy--set-candidates'.")
 
+(defcustom ivy-use-ignore-default t
+  "The default policy for user-configured candidate filtering."
+  :type '(choice
+          (const :tag "Ignore ignored always" always)
+          (const :tag "Ignore ignored when others exist" t)
+          (const :tag "Don't ignore" nil)))
+
 (defvar ivy-use-ignore t
-  "Store policy for user-configured candidate filtering.")
+  "Store policy for user-configured candidate filtering.
+This may be changed dynamically by `ivy-toggle-ignore'.
+Use `ivy-use-ignore-default' for a permanent configuration.")
 
 (defvar ivy--default nil
   "Default initial input.")
@@ -808,7 +817,10 @@ If the input is empty, select the previous history element 
instead."
 (defun ivy-toggle-ignore ()
   "Toggle user-configured candidate filtering."
   (interactive)
-  (setq ivy-use-ignore (null ivy-use-ignore))
+  (setq ivy-use-ignore
+        (if ivy-use-ignore
+            nil
+          (or ivy-use-ignore-default t)))
   ;; invalidate cache
   (setq ivy--old-cands nil))
 
@@ -1389,7 +1401,7 @@ This is useful for recursive `ivy-read'."
     (setq ivy--full-length nil)
     (setq ivy-text "")
     (setq ivy-calling nil)
-    (setq ivy-use-ignore t)
+    (setq ivy-use-ignore ivy-use-ignore-default)
     (let (coll sort-fn)
       (cond ((eq collection 'Info-read-node-name-1)
              (if (equal Info-current-file "dir")
@@ -2682,7 +2694,8 @@ Skip buffers that match `ivy-ignore-buffers'."
                   (string-match-p f-or-r buf)))
               ivy-ignore-buffers))
            res)
-          res))))
+          (and (eq ivy-use-ignore t)
+               res)))))
 
 (ivy-set-display-transformer
  'ivy-switch-buffer 'ivy-switch-buffer-transformer)



reply via email to

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