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

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

[elpa] externals/vertico f3c0e7c 35/48: tidy shadowed file names


From: Stefan Monnier
Subject: [elpa] externals/vertico f3c0e7c 35/48: tidy shadowed file names
Date: Mon, 5 Apr 2021 10:54:45 -0400 (EDT)

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

    tidy shadowed file names
---
 minicomp.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/minicomp.el b/minicomp.el
index 78dda0f..0bd51eb 100644
--- a/minicomp.el
+++ b/minicomp.el
@@ -33,8 +33,8 @@
 
 ;;; Code:
 
-(require 'seq)
 (require 'cl-lib)
+(require 'seq)
 (eval-when-compile
   (require 'subr-x))
 
@@ -231,7 +231,7 @@
                      (setcdr last nil))
                  0))
          (total))
-    (when (eq (completion-metadata-get metadata 'category) 'file)
+    (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)
@@ -348,8 +348,20 @@
                                  (if (< minicomp--index 0) "*" (1+ 
minicomp--index))
                                  minicomp--total)))))
 
+(defun minicomp--tidy-shadowed-file ()
+  "Tidy shadowed file name."
+  (when (and minibuffer-completing-file-name
+             (eq this-command #'self-insert-command)
+             (bound-and-true-p rfn-eshadow-overlay)
+             (overlay-buffer rfn-eshadow-overlay)
+             (= (point) (point-max))
+             (or (>= (- (point) (overlay-end rfn-eshadow-overlay)) 2)
+                 (eq ?/ (char-before (- (point) 2)))))
+    (delete-region (overlay-start rfn-eshadow-overlay) (overlay-end 
rfn-eshadow-overlay))))
+
 (defun minicomp--exhibit ()
   "Exhibit completion UI."
+  (minicomp--tidy-shadowed-file)
   (let ((metadata (completion--field-metadata (minibuffer-prompt-end)))
         (input (minibuffer-contents-no-properties)))
     (unless (equal minicomp--input input)



reply via email to

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