branch: elpa/bash-completion
commit c5d4f92e6ddb45d809c5cf8390d3eb7621e56975
Author: Stephane Zermatten <[email protected]>
Commit: Stephane Zermatten <[email protected]>
Still EMACS_BASH_COMPLETE using setenv for local processes.
Setting EMACS_BASH_COMPLETE after process startup doesn't quite work,
as it doesn't apply to init file loaded automatically by bash.
Fix for 802eb4e
---
bash-completion.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/bash-completion.el b/bash-completion.el
index f80b1c94bf..5876b1e488 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -928,6 +928,7 @@ is set to t."
(unwind-protect
(progn
(setenv "TERM" "dumb")
+ (setenv "EMACS_BASH_COMPLETE" "t")
(let* ((start-proc-fun (if remote #'start-file-process
#'start-process))
(buffer-name (generate-new-buffer-name "
bash-completion"))
(args `("*bash-completion*"
@@ -948,7 +949,13 @@ is set to t."
;; user
(setq process (apply start-proc-fun args))))
(set-process-query-on-exit-flag process nil)
- (process-send-string process "EMACS_BASH_COMPLETE=t\n")
+ (if remote
+ ;; Set EMACS_BASH_COMPLETE now for remote
+ ;; completion, since setenv doesn't work. This will
+ ;; unfortunately not be available in .bashrc or
+ ;; .bash_profile. TODO: Find a way of getting it to
+ ;; work from the very beginning.
+ (process-send-string process "EMACS_BASH_COMPLETE=t\n"))
(dolist (start-file bash-completion-start-files)
(when (file-exists-p (bash-completion--expand-file-name
start-file))
(process-send-string process (concat ". " start-file "\n"))))
@@ -1001,6 +1008,7 @@ is set to t."
process)
;; finally
(progn
+ (setenv "EMACS_BASH_COMPLETE" nil)
(setenv "TERM" oldterm)
(when cleanup
(condition-case nil