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

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

[elpa] externals/vertico d57d390 34/48: Support partial completion for f


From: Stefan Monnier
Subject: [elpa] externals/vertico d57d390 34/48: Support partial completion for files
Date: Mon, 5 Apr 2021 10:54:45 -0400 (EDT)

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

    Support partial completion for files
    
    Sorting by history does not yet work for partial completion.
    It is difficult to support this efficiently.
---
 README.org  | 12 +++++++++---
 minicomp.el |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 6a7e554..90e28ab 100644
--- a/README.org
+++ b/README.org
@@ -24,7 +24,13 @@ Complementary packages, which are supported:
 * Configuration
 
 #+begin_src emacs-lisp
-(use-package minicomp
-  :init
-  (minicomp-mode))
+  (use-package minicomp
+    :init
+    (minicomp-mode))
+
+  (use-package orderless
+    :init
+    (setq completion-styles '(orderless)
+          completion-category-defaults nil
+          completion-category-overrides '((file (styles . 
(partial-completion))))))
 #+end_src
diff --git a/minicomp.el b/minicomp.el
index c336839..78dda0f 100644
--- a/minicomp.el
+++ b/minicomp.el
@@ -34,6 +34,7 @@
 ;;; Code:
 
 (require 'seq)
+(require 'cl-lib)
 (eval-when-compile
   (require 'subr-x))
 
@@ -231,7 +232,7 @@
                  0))
          (total))
     (when (eq (completion-metadata-get metadata 'category) 'file)
-      (setq all (delete "../" (delete "./" all))))
+      (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

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