[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 04393bca0f 250/313: Apply filename post-pr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 04393bca0f 250/313: Apply filename post-processing even when prefix doesn't match. |
Date: |
Sat, 3 Dec 2022 10:59:35 -0500 (EST) |
branch: elpa/bash-completion
commit 04393bca0fedea682301d8ad796bdb5179917995
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Apply filename post-processing even when prefix doesn't match.
Before this change, the case where completion doesn't match the prefix
was special-cased, and bypassed the post-processing that detects
filename type, adding / or " ". With this change, the post-processing
is applied both when the prefix matched and when it didn't.
---
bash-completion.el | 54 ++++++++++++++++++++++++++----------------------------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 70a60c5b4b..c826741622 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -958,7 +958,6 @@ for directory name detection to work."
(wordbreaks (bash-completion--wordbreaks comp))
(suffix "")
(rest) ; the part between the prefix and the suffix
- (whole)
(rebuilt))
;; build rest by removing parsed-prefix from str
@@ -990,34 +989,33 @@ for directory name detection to work."
;; Bypass the whole prefix/suffix logic and replace the string
;; being completed with the string provided by the completion
;; logic.
- (t (setq whole str)))
+ (t (setq unparsed-prefix ""
+ parsed-prefix ""
+ rest str)))
- (if whole
- (bash-completion-escape-candidate whole nil)
-
- ;; build suffix
- (let ((last-char (bash-completion-last-char rest))
- (close-quote-str (if open-quote (char-to-string open-quote) ""))
- (final-space-str (if nospace "" " ")))
- (cond
- ((eq ?\ last-char)
- (setq rest (substring rest 0 -1))
- (setq suffix (concat close-quote-str final-space-str)))
- ((or (bash-completion--find-last last-char wordbreaks)
- (eq ?/ last-char))
- (setq suffix ""))
- ((file-accessible-directory-p
- (bash-completion--expand-file-name (bash-completion-unescape
- open-quote (concat
parsed-prefix rest))))
- (setq suffix "/"))
- (single
- (setq suffix (concat close-quote-str final-space-str)))
- (t (setq suffix close-quote-str))))
-
- ;; put everything back together
- (concat unparsed-prefix
- (bash-completion-escape-candidate rest open-quote)
- suffix))))
+ ;; build suffix
+ (let ((last-char (bash-completion-last-char rest))
+ (close-quote-str (if open-quote (char-to-string open-quote) ""))
+ (final-space-str (if nospace "" " ")))
+ (cond
+ ((eq ?\ last-char)
+ (setq rest (substring rest 0 -1))
+ (setq suffix (concat close-quote-str final-space-str)))
+ ((or (bash-completion--find-last last-char wordbreaks)
+ (eq ?/ last-char))
+ (setq suffix ""))
+ ((file-accessible-directory-p
+ (bash-completion--expand-file-name (bash-completion-unescape
+ open-quote (concat parsed-prefix
rest))))
+ (setq suffix "/"))
+ (single
+ (setq suffix (concat close-quote-str final-space-str)))
+ (t (setq suffix close-quote-str))))
+
+ ;; put everything back together
+ (concat unparsed-prefix
+ (bash-completion-escape-candidate rest open-quote)
+ suffix)))
(defun bash-completion-escape-candidate (completion-candidate open-quote)
"Escapes COMPLETION-CANDIDATE.
- [nongnu] elpa/bash-completion 802eb4e5a8 194/313: Set EMACS_BASH_COMPLETE even on remote (tramp) completion., (continued)
- [nongnu] elpa/bash-completion 802eb4e5a8 194/313: Set EMACS_BASH_COMPLETE even on remote (tramp) completion., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fbdc78b877 198/313: Support compopt when using Bash 4., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1bd3d528f 201/313: Improve some docstrings, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fa49dbb382 209/313: Improve status code retrieval, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7822d84812 223/313: Added Cask with ert-runner to compile and run test., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 31a01859b2 227/313: Do not run tests under Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 21471cc542 228/313: Report result of running the test workflow on README.md., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 98a2a21be7 234/313: Provide a way of refreshing the completion table., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4fcddf83c9 242/313: Make /etc/bash_completion scripts work with escaped spaces., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2dbc7e61f6 248/313: Extend bash-completion-refresh to refresh everything, test it., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 04393bca0f 250/313: Apply filename post-processing even when prefix doesn't match.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 2a937b3763 255/313: Don't let Emacs post-filter completions built by bash., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e95867c993 256/313: completion-table-with-cache captures and restore buffer and variables., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 747920fdbf 265/313: Avoid having to set BASH_COMPLETION., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f15176ee59 267/313: Fix to properly evaluate PROMPT_COMMAND after restoring it., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b4ae893243 268/313: Test prompt and history manipulation, fix $? in prompt., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 20feaf909d 258/313: Fix markdown markup., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8713edbb92 269/313: Mention that completion works with bash 5, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4b80c75c43 272/313: Take current directory from shell when in single-process mode., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ea5cc15b99 273/313: Let status code of compgen through when in single-process mode., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 12da4f0e91 289/313: Better handle slow completion functions., ELPA Syncer, 2022/12/03