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

    Filter files with completion-ignored-extensions
---
 minicomp.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/minicomp.el b/minicomp.el
index c7f9425..8432940 100644
--- a/minicomp.el
+++ b/minicomp.el
@@ -33,7 +33,6 @@
 
 ;;; Code:
 
-(require 'cl-lib)
 (require 'seq)
 (eval-when-compile
   (require 'subr-x))
@@ -220,10 +219,17 @@
 
 (defun minicomp--recompute-candidates (input metadata)
   "Recompute candidates with INPUT string and METADATA."
-  (let* ((all (completion-all-completions
+  (let* ((ignore-re (concat "\\(?:\\`\\|/\\)\\.?\\./\\'"
+                            (and completion-ignored-extensions
+                                 (concat "\\|" (regexp-opt 
completion-ignored-extensions) "\\'"))))
+         (all (completion-all-completions
                input
                minibuffer-completion-table
-               minibuffer-completion-predicate
+               (if minibuffer-completing-file-name
+                   (if-let (pred minibuffer-completion-predicate)
+                       (lambda (x) (and (not (string-match-p ignore-re x)) 
(funcall pred x)))
+                     (lambda (x) (not (string-match-p ignore-re x))))
+                 minibuffer-completion-predicate)
                (- (point) (minibuffer-prompt-end))
                metadata))
          (base (if-let (last (last all))
@@ -231,8 +237,6 @@
                      (setcdr last nil))
                  0))
          (total))
-    (when minibuffer-completing-file-name
-      (setq all (cl-delete-if (apply-partially #'string-match-p 
"\\(\\`\\|/\\)\\.?\\./\\'") all)))
     (setq total (length all)
           all (if (> total minicomp-sort-threshold)
                   all

Reply via email to