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

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

[nongnu] elpa/bash-completion 7965b914da 160/313: Re-enable directory ex


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 7965b914da 160/313: Re-enable directory expansion for custom completion. fixes #23
Date: Sat, 3 Dec 2022 10:59:26 -0500 (EST)

branch: elpa/bash-completion
commit 7965b914da4483af8872f359eef9686b7a53b97a
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    Re-enable directory expansion for custom completion. fixes #23
    
    I tured off directory expansion (adding a trailing /) by mistake when
    refactoring the expansion code. While doing directory expansion is not
    necessarily always the right thing to do with custom completion, it
    usually is. This commit turns it back on.
    
    issue #19 should allow properly configuring this behavior
    command-by-command.
---
 bash-completion.el           |  2 +-
 test/bash-completion-test.el | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index 269230afbc..63955c81b5 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -837,7 +837,7 @@ for directory name detection to work."
             (eq ?/ last-char))
         (setq suffix ""))
        ((and
-         (memq completion-type '(command default wordbreak))
+         (memq completion-type '(command default wordbreak custom))
          (file-accessible-directory-p
           (expand-file-name (bash-completion-unescape
                              open-quote (concat parsed-prefix rest))
diff --git a/test/bash-completion-test.el b/test/bash-completion-test.el
index 5983e5e775..5532da53e0 100644
--- a/test/bash-completion-test.el
+++ b/test/bash-completion-test.el
@@ -915,7 +915,7 @@ before calling `bash-completion-dynamic-complete-nocomint'.
               '("--color=")
               (nth 2 (bash-completion-dynamic-complete-nocomint 3 
(point))))))))
 
-(ert-deftest bash-completion-single-custom-completion-as-directory ()
+(ert-deftest bash-completion-single-custom-completion-as-directory-explicit ()
   (--with-fake-bash-completion-send
    (setq bash-completion-alist '(("ls" "compgen" "args")))
    (push "somedir/\n" --send-results)
@@ -925,6 +925,19 @@ before calling `bash-completion-dynamic-complete-nocomint'.
               '("somedir/")
               (nth 2 (bash-completion-dynamic-complete-nocomint 3 
(point))))))))
 
+(ert-deftest bash-completion-single-custom-completion-as-directory-implicit ()
+  (--with-fake-bash-completion-send
+   (setq bash-completion-alist '(("ls" "compgen" "args")))
+   ;; note that adding a / after a completion is not always the right thing
+   ;; to do. See github issue #19.
+   (push "/tmp/test/somedir" --directories)
+   (push "somedir\n" --send-results)
+   (insert "$ ls some")
+   (let ((bash-completion-nospace nil))
+     (should (equal
+              '("somedir/")
+              (nth 2 (bash-completion-dynamic-complete-nocomint 3 
(point))))))))
+
 (ert-deftest bash-completion-custom-completion-with-fallback ()
   (--with-fake-bash-completion-send
    (setq bash-completion-alist '(("ls" "compgen" "args")))



reply via email to

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