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

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

[nongnu] elpa/bash-completion 21149fdc27 152/313: Introduce the variable


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 21149fdc27 152/313: Introduce the variable bash-completion-start-files, that allow
Date: Sat, 3 Dec 2022 10:59:25 -0500 (EST)

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

    Introduce the variable bash-completion-start-files, that allow
    configuring the shell files that are loaded on the bash completion
    subprocess, by default ~/.emacs_bash.sh and ~/.emacs.d/init_bash.sh,
    to preserve backward compatibility.
    
    The main goal of this change is to control which initialization files
    are loaded during tests.
---
 bash-completion.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index da211ed8fb..724697581a 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -194,6 +194,11 @@ to remove the extra space bash adds after a completion."
   :type '(boolean)
   :group 'bash-completion)
 
+(defvar bash-completion-start-files
+  '("~/.emacs_bash.sh" "~/.emacs.d/init_bash.sh")
+  "Shell files that, if they exist, will be sourced at the
+beginning of a bash completion subprocess.")
+
 ;;; ---------- Internal variables and constants
 
 (defvar bash-completion-process nil
@@ -984,14 +989,10 @@ is set to t."
                             ,bash-completion-prog)
                           bash-completion-args)))
            (set-process-query-on-exit-flag process nil)
-           (let* ((shell-name (file-name-nondirectory bash-completion-prog))
-                  (startfile1 (concat "~/.emacs_" shell-name ".sh"))
-                  (startfile2 (concat "~/.emacs.d/init_" shell-name ".sh")))
-             (cond
-              ((file-exists-p startfile1)
-               (process-send-string process (concat ". " startfile1 "\n")))
-              ((file-exists-p startfile2)
-               (process-send-string process (concat ". " startfile2 "\n")))))
+           (let ((shell-name (file-name-nondirectory bash-completion-prog)))
+              (dolist (start-file bash-completion-start-files)
+                ((file-exists-p startfile1)
+                 (process-send-string process (concat ". " startfile1 "\n")))))
            (bash-completion-send "PROMPT_COMMAND='';PS1='\t$?\v'" process 
bash-completion-initial-timeout)
            (bash-completion-send (concat "function __bash_complete_wrapper {"
                                          " eval $__BASH_COMPLETE_WRAPPER;"



reply via email to

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