szermatt / emacs-bash-completion

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

Help macOS #69

Closed aadcg closed 2 months ago

aadcg commented 3 months ago

I have been using this amazing package for years on Linux, but I'm not able to make work on macOS with the same configuration. It invariably reports "No match". Please see the report below. Any idea? Thanks!

macOS

commandline: <<EOF
if type __ebcpre &>/dev/null; then   __ebcpre; __ebcompgen -b -c -a -A function -- pw; else   echo ==emacs==nopre=${BASH_VERSION}==.;   __ebcp=("$PS1" "$PROMPT_COMMAND");  unset PS1 PROMPT_COMMAND;fi;
EOF

status: 0
process: #<process shell>
output-buffer: <<EOF
EOF

emacs-version: "29.2"
bash-version: "5.2.26(1)-release"
bash-version: "5.2.26(1)-release"
context: #s(completion "pw"
              ("pw")
              0 "pw" 92 "pw" nil nil "" nil)

Linux

commandline: <<EOF
if type __ebcpre &>/dev/null; then __ebcpre; __ebcompgen -b -c -a -A function -- pw; else echo ==emacs==nopre=${BASH_VERSION}==.; fi;
EOF

status: 0
process: #<process shell>
output-buffer: <<EOF
pwd
pwd
pwdx
pwd
pwck
pwconv
pwunconv
pwd
EOF

emacs-version: "29.1"
bash-version: "5.1.16(1)-release"
bash-version: "5.1.16(1)-release"
context: #s(completion "pw"
              ("pw")
              0 "pw" 6860 "pw" nil nil "\"'><=;|&(:" nil)
szermatt commented 3 months ago

I'm not sure what could be happening, here. There isn't much information. I know it works on macos, generally, because I primarily use it on a mac. I'll try and reproduce the issue with the specific combination of Emacs and Bash you have, to see whether it's a version issue.

In the meantime, could you try turning off all customization in Bash and Emacs? Something in the configuration could be triggering some version-specific or OS-specific issue, even if the configuration is the same in both cases.

Another thing that would be useful for you to try would be to set bash-completion-use-separate-processes to t, using M-x customize bash-completion-use-separate-processes. I'm not recommending you always use bash completion that way. Knowing whether this works or not would help me figure out where the problem comes from.

szermatt commented 3 months ago

I'll try and reproduce the issue with the specific combination of Emacs and Bash you have, to see whether it's a version issue.

If only it were that simple. I just checked that: the latest version of emacs-bash-completion from github running on Emacs 29.2 with Bash 5.2.26 as shell with no customization on a mac (Sonoma) and it worked.

It's not just a version issue, unfortunately.

By the way, what version of emacs-bash-completion are you running?

aadcg commented 3 months ago

@szermatt thanks for looking into it.

I'm testing it by issuing emacs -q --load ~/.emacs.d/test-init.el where test-init.el is as below. Unfortunately, it doesn't work.


(setq explicit-shell-file-name (executable-find "bash"))

(load "/Users/macbook/.emacs.d/elpa/bash-completion-20230612.1103/bash-completion.el")
(bash-completion-setup)
(setq bash-completion-use-separate-processes t) ; makes no difference

Version f1daac0386c24cbe8a244a62c7588cc6847b07ae.


I'm under the impression that the issue might be not related to this package but somehow related to my environment (Nix). Note that explicit-shell-file-name above resolves to /Users/macbook/.nix-profile/bin/bash.

aadcg commented 2 months ago

I didn't reach any meaningful conclusion and I think the issue isn't related to the package. Thanks.