[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 328e28126a 4/4: Include Bash version into
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 328e28126a 4/4: Include Bash version into the output of M-x bash-completion-debug |
Date: |
Thu, 2 Mar 2023 14:59:52 -0500 (EST) |
branch: elpa/bash-completion
commit 328e28126a625c4669511b7f0047b4efbf095939
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <stephane@fuzzy.zia>
Include Bash version into the output of M-x bash-completion-debug
When using separate processes, Bash version is captured once per
process, otherwise it is captured for every completion command, as it
might change.
---
bash-completion.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index e01f64cff1..442e839ddb 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -428,6 +428,12 @@ returned."
"}")
process)
+ (bash-completion-send "echo -n $BASH_VERSION" process)
+ (process-put process 'bash-version
+ (with-current-buffer (bash-completion--get-buffer process)
+ (buffer-substring-no-properties
+ (point-min) (point-max))))
+
(bash-completion-send "echo -n ${COMP_WORDBREAKS}" process)
(process-put process 'wordbreaks
(with-current-buffer (bash-completion--get-buffer process)
@@ -1486,7 +1492,7 @@ Return the status code of the command, as a number."
(bash-completion-use-separate-processes "%s\n")
;; single process, assume __ebcpre is already defined
((not define-functions)
- "type __ebcpre &>/dev/null || echo
==emacs==nopre=${BASH_VERSINFO[0]}==. && { __ebcpre; %s; }\n")
+ "type __ebcpre &>/dev/null || echo
==emacs==nopre=${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}==. && { __ebcpre; %s;
}\n")
;; single process, define __ebcpre
(t
(concat
@@ -1498,7 +1504,7 @@ Return the status code of the command, as a number."
" history -d $c &>/dev/null || true;"
"}; function __ebcpre {"
" set +x; set +o emacs; set +o vi;"
- " echo \"==emacs==bash=${BASH_VERSINFO[0]}==.\";"
+ " echo
\"==emacs==bash=${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}==.\";"
" if [[ -z \"${__ebcps1}\" ]]; then "
" __ebcps1=\"$PS1\";"
" __ebcpc=\"$PROMPT_COMMAND\";"
@@ -1530,8 +1536,9 @@ Return the status code of the command, as a number."
(funcall send-string process complete-command)
(unless bash-completion-use-separate-processes
(bash-completion--wait-for-regexp
- "short-timeout" process "==emacs==\\(nopre\\|bash\\)=[0-9]==."
+ "short-timeout" process
"==emacs==\\(nopre\\|bash\\)=\\([0-9]\\.[0-9]*\\)==."
bash-completion-short-command-timeout)
+ (push (cons 'bash-version (match-string 2))
bash-completion--debug-info)
(when (string= "nopre" (match-string 1))
;; __ecbpre isn't defined yet. We're talking to an
;; un-initialized instance of Bash. Define the utility
@@ -1541,7 +1548,7 @@ Return the status code of the command, as a number."
(bash-completion--setup-bash-common process)
(funcall send-string process (concat "__ebcpre; " commandline ";\n"))
(bash-completion--wait-for-regexp
- "short-timeout" process "==emacs==bash=[0-9]==."
+ "short-timeout" process "==emacs==bash=[0-9]\\.[0-9]*==."
bash-completion-short-command-timeout))
(delete-region (point-min) (1+ (match-end 0))))
(bash-completion--wait-for-regexp "timeout" process
"==emacs==ret=-?[[:digit:]]+==." timeout)
@@ -1597,6 +1604,8 @@ Return the status code of the command, as a number."
(bash-completion--debug-print-info 'use-separate-processes)
(bash-completion--debug-print 'emacs-version emacs-version)
+ (bash-completion--debug-print-procinfo 'bash-version) ; separate process
+ (bash-completion--debug-print-info 'bash-version) ; one process
(bash-completion--debug-print-procinfo 'completion-ignore-case)
(bash-completion--debug-print-info 'context)))