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

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

[elpa] externals/ivy-hydra 7b9b3cc 200/395: ivy.el (ivy--switch-buffer-m


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 7b9b3cc 200/395: ivy.el (ivy--switch-buffer-matcher): Complete remote dirs via ":"
Date: Thu, 25 Feb 2021 08:32:02 -0500 (EST)

branch: externals/ivy-hydra
commit 7b9b3cc3050b66d70e1a754178d0828fbf5bbbba
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy--switch-buffer-matcher): Complete remote dirs via ":"
    
    When `ivy-text' starts with ":", offer remote dirs for completion.
---
 ivy.el | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/ivy.el b/ivy.el
index 6d560ef..13e49b8 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4545,21 +4545,30 @@ Otherwise, forward to `ivy-kill-line'."
 (defun ivy--switch-buffer-matcher (regexp candidates)
   "Return REGEXP matching CANDIDATES.
 Skip buffers that match `ivy-ignore-buffers'."
-  (let ((res (ivy--re-filter regexp candidates)))
-    (if (or (null ivy-use-ignore)
-            (null ivy-ignore-buffers))
-        res
-      (or (cl-remove-if
-           (lambda (buf)
-             (cl-find-if
-              (lambda (f-or-r)
-                (if (functionp f-or-r)
-                    (funcall f-or-r buf)
-                  (string-match-p f-or-r buf)))
-              ivy-ignore-buffers))
-           res)
-          (and (eq ivy-use-ignore t)
-               res)))))
+  (if (string-match-p "^:" ivy-text)
+      (delete-dups
+       (cl-remove-if-not
+        (lambda (s)
+          (let ((b (get-buffer s)))
+            (and b
+                 (string-match-p regexp (buffer-local-value 'default-directory 
b))
+                 (not (string-match-p "^\\*" s)))))
+        candidates))
+    (let ((res (ivy--re-filter regexp candidates)))
+      (if (or (null ivy-use-ignore)
+              (null ivy-ignore-buffers))
+          res
+        (or (cl-remove-if
+             (lambda (buf)
+               (cl-find-if
+                (lambda (f-or-r)
+                  (if (functionp f-or-r)
+                      (funcall f-or-r buf)
+                    (string-match-p f-or-r buf)))
+                ivy-ignore-buffers))
+             res)
+            (and (eq ivy-use-ignore t)
+                 res))))))
 
 (defun ivy-append-face (str face)
   "Append to STR the property FACE."



reply via email to

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