prompt disappears after running just one command
Opened this issue · 1 comments
This is from a plain shell mode. Please note that I have not configured my bash prompt in any way for this example. (I get the same behavior with my regular prompt)
bash-5.1$ ls
Desktop Documents Downloads hold isos notes scratch1.txt scratch2.txt src wireshark yabsm
pwd
/home/nick
cd ./.emacs.d
pwd
/home/nick/.emacs.d
As you can see the commands are still being entered but there is just no prompt. If I kill the shell and start a new one I get the same behavior over and over.
This behavior is totally fixed if I do not use bash-completion.
The only configuring I have done is this:
(use-package bash-completion
:config
(bash-completion-setup))
I am using Emacs 27.1
Hi!
I haven't been able to reproduce your problem. emacs-bash-completion does modify the shell prompts temporarily, so it is possible that something went wrong and that the prompts were not set back to their original value, as they should have been.
All I can offer you at this point is a workaround. I think that if you call:
(set bash-completion-use-separate-processes t)
just before bash-completion-setup, you won't have that problem anymore. That's because it switches bash completion to a mode that doesn't need to change the prompt at all, as it creates a separate process.
I suspect that there's something in your bash configuration or system that is causing this issue. It might not be necessarily linked to the bash prompt; it could be many things, unfortunately.
If you have the time, it would be very nice if you could try the following:
- install emacs-bash-completion into your Emacs instance without setting bash-completion-use-separate-processes.
- open a shell
- type
PS1="\s-\v\$ "
then press return - type
PROMPT_COMMAND=""
then press return - type
set -x
in the shell, then press return - M-x bash-completion-refresh
- press return in the shell
- make a copy of the content of the shell buffer
- M-x bash-completion-debug
- make a copy of the content of the buffer opened by bash-completion-debug
And add to this issue the content of:
- the shell buffer
- the buffer opened by bash-completion-debug
On my test machine, the shell buffer looks like the following at the end:
bash-5.1$ PS1="\s-\v\$ "
bash-5.1$ PROMPT_COMMAND=""
bash-5.1$ set -x
bash-5.1$
++ __emacs_complete_recover_prompt
++ local r=0
++ PS1='\s-\v$ '
++ PROMPT_COMMAND=
++ unset __emacs_complete_ps1 __emacs_complete_pc
++ [[ -n '' ]]
bash-5.1$
bash-5.1$
I'd be interest in seeing any differences.