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

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

[elpa] externals/vertico 0115a6e01d: vertico-directory-enter: Exit if di


From: ELPA Syncer
Subject: [elpa] externals/vertico 0115a6e01d: vertico-directory-enter: Exit if directory does not change
Date: Sun, 19 Nov 2023 15:58:50 -0500 (EST)

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

    vertico-directory-enter: Exit if directory does not change
    
    See https://github.com/minad/vertico/discussions/411
---
 extensions/vertico-directory.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/extensions/vertico-directory.el b/extensions/vertico-directory.el
index 638c0028c7..c6989dbb22 100644
--- a/extensions/vertico-directory.el
+++ b/extensions/vertico-directory.el
@@ -54,14 +54,16 @@ Exit with current input if prefix ARG is given."
            (cand (vertico--candidate))
            ((or (string-suffix-p "/" cand)
                 (and (vertico--remote-p cand)
-                     (string-suffix-p ":" cand)))))
+                     (string-suffix-p ":" cand))))
+           ;; Handle /./ and /../ manually instead of via `expand-file-name'
+           ;; and `abbreviate-file-name', such that we don't accidentally
+           ;; perform unwanted substitutions in the existing completion.
+           ((progn
+              (setq cand (string-replace "/./" "/" cand))
+              (unless (string-suffix-p "/../../" cand)
+                (setq cand (replace-regexp-in-string "/[^/|:]+/\\.\\./\\'" "/" 
cand)))
+              (not (equal (minibuffer-contents-no-properties) cand)))))
       (progn
-        ;; Handle ./ and ../ manually instead of via `expand-file-name' and
-        ;; `abbreviate-file-name', such that we don't accidentally perform
-        ;; unwanted substitutions in the existing completion.
-        (setq cand (replace-regexp-in-string "/\\./" "/" cand))
-        (unless (string-suffix-p "/../../" cand)
-          (setq cand (replace-regexp-in-string "/[^/|:]+/\\.\\./\\'" "/" 
cand)))
         (delete-minibuffer-contents)
         (insert cand))
     (vertico-exit arg)))



reply via email to

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