szermatt / emacs-bash-completion

Add programmable bash completion to Emacs shell-mode
GNU General Public License v2.0
281 stars 33 forks source link

bash-completion fails #64

Closed ctanis closed 1 year ago

ctanis commented 1 year ago

This error looks different than the one in the other recent issue:

I get what looks like all the output from the bash-completion directly in my shell, but nothing ever actually completes. Here's the contents of the bash-completion-debug after trying to expand "cat .emacs"

commandline: <<EOF
type __ebcpre &>/dev/null || echo ==emacs==nopre=${BASH_VERSINFO[0]}==. && { __ebcpre; compgen -o default -- .emacs 2>/dev/null  > >(__ebcfixdirs); wait $!; }
EOF

status: 127
process: #<process shell>
output-buffer: <<EOF
bash: wait: pid 14618 is not a child of this shell
EOF

emacs-version: "27.1"
completion-ignore-case: t
context: #s(completion "cat .emacs"
              ("cat" ".emacs")
              1 ".emacs" 15 ".emacs" nil nil nil nil)
szermatt commented 1 year ago

That seems to be a new one, yes. Bash seems to interpret wait $! differently from what's expected. There might be some version-specific differences.

What's the version of the Bash shell you're using? If you type

echo $BASH_VERSION

in an Emacs shell buffer, what's the output?

ctanis commented 1 year ago

4.2.46(2)-release

szermatt commented 1 year ago

Thank you! That's it: I managed to reproduce the issue with Bash 4.2 I hadn't realized that the latest versions rely on a feature added in Bash 4.4 😞

I'll work on a patch that introduces a fallback for it to work under bash 4.0 to 4.3, because it can be really annoying to have to upgrade bash everywhere.

In the meantime, I'd suggest upgrading your version of bash to 4.4 if it is possible or using an older version of bash-completion.el, such as the one from melpa stable.

szermatt commented 1 year ago

I'll work on a patch that introduces a fallback for it to work under bash 4.0 to 4.3,

I eventually added limited support for 4.2 and 4.3 but 4.0 and 4.1 had too many issues, so I just added a check and made it clear that they won't work.