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

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

[elpa] externals/consult 05c9664 1/2: consult-completion-in-region: Ensu


From: ELPA Syncer
Subject: [elpa] externals/consult 05c9664 1/2: consult-completion-in-region: Ensure that ./ and ../ prefix is kept for shell (Fix #356)
Date: Sat, 10 Jul 2021 12:57:07 -0400 (EDT)

branch: externals/consult
commit 05c96647572b16979b538daa31a181d944ecc16b
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult-completion-in-region: Ensure that ./ and ../ prefix is kept for 
shell (Fix #356)
---
 consult.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/consult.el b/consult.el
index 9badfbb..4350814 100644
--- a/consult.el
+++ b/consult.el
@@ -2108,9 +2108,20 @@ These configuration options are supported:
                        (consult--insertion-preview start end)
                        ;; transformation function
                        (if (eq category 'file)
-                           (if (file-name-absolute-p initial)
-                               (lambda (_inp cand) (substitute-in-file-name 
cand))
-                             (lambda (_inp cand) (file-relative-name 
(substitute-in-file-name cand))))
+                           (cond
+                            ;; Transform absolute file names
+                            ((file-name-absolute-p initial)
+                             (lambda (_inp cand)
+                               (substitute-in-file-name cand)))
+                            ;; Ensure that ./ prefix is kept for the shell 
(#356)
+                            ((string-prefix-p "./" initial)
+                             (lambda (_inp cand)
+                               (setq cand (file-relative-name 
(substitute-in-file-name cand)))
+                               (if (string-match-p "\\`\\.\\.?/" cand) cand 
(concat "./" cand))))
+                            ;; Simplify relative file names
+                            (t
+                             (lambda (_inp cand)
+                               (file-relative-name (substitute-in-file-name 
cand)))))
                          (lambda (_inp cand) cand))
                        ;; candidate function
                        (apply-partially #'run-hook-with-args-until-success



reply via email to

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