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

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

[nongnu] elpa/bash-completion ea5cc15b99 273/313: Let status code of com


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion ea5cc15b99 273/313: Let status code of compgen through when in single-process mode.
Date: Sat, 3 Dec 2022 10:59:37 -0500 (EST)

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

    Let status code of compgen through when in single-process mode.
    
    (bash-completion-send) is supposed to return the status of the
    command. However, when running in single-process mode, a command was
    executed after the main command, so the status returned was the status
    of that second command.
    
    This change transforms __emacs_complete_post_command into
    __bash_complete_pre_command.
    
    This change also silences errors from the history command, which is
    how this issue came to light, as errors from history made it look like
    the compgen command failed.
---
 bash-completion.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index b9c2d4c571..a30379cd94 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1238,18 +1238,18 @@ if [[ -z \"$__emacs_complete_ps1\" ]]; then \
   __emacs_complete_ps1=\"$PS1\"\
   __emacs_complete_pc=\"$PROMPT_COMMAND\"; \
 fi; \
-PS1='' PROMPT_COMMAND=''; history -d $((HISTCMD - 1))\n")
+PS1='' PROMPT_COMMAND=''; history &>/dev/null -d $((HISTCMD - 1))\n")
           
           ;; The following is a bootstrap command for
           ;; bash-completion-send itself.
           (bash-completion-send
-            "function __emacs_complete_post_command { 
+            "function __emacs_complete_pre_command { 
   if [[ -z \"$__emacs_complete_ps1\" ]]; then
     __emacs_complete_ps1=\"$PS1\"
     __emacs_complete_pc=\"$PROMPT_COMMAND\"
   fi
   PROMPT_COMMAND=__emacs_complete_prompt
-  history -d $((HISTCMD - 1))
+  history &>/dev/null -d $((HISTCMD - 1))
 }; \
 function __emacs_complete_prompt {
   PS1='\t$?\v'
@@ -1263,7 +1263,7 @@ function __emacs_complete_recover_prompt {
   if [[ -n \"$PROMPT_COMMAND\" ]]; then
     (exit $r); eval \"$PROMPT_COMMAND\"
   fi
-}" process)
+}; __emacs_complete_pre_command" process)
           (bash-completion--setup-bash-common process))
         process))))
 
@@ -1502,12 +1502,11 @@ Return the status code of the command, as a number."
         (send-string (if bash-completion-use-separate-processes
                          #'process-send-string
                        #'comint-send-string))
-        (post-command (if bash-completion-use-separate-processes
-                          "\n"
-                        "; __emacs_complete_post_command;\n")))
+        (pre-command (unless bash-completion-use-separate-processes
+                        "__emacs_complete_pre_command; ")))
     (with-current-buffer (bash-completion--get-buffer process)
       (erase-buffer)
-      (funcall send-string process (concat commandline post-command))
+      (funcall send-string process (concat pre-command commandline "\n"))
       (unless (bash-completion--wait-for-regexp process "\t-?[[:digit:]]+\v" 
timeout)
         (error (concat
                 "Timeout while waiting for an answer from "



reply via email to

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