emacs-helm / helm

Emacs incremental completion and selection narrowing framework
https://emacs-helm.github.io/helm/
GNU General Public License v3.0
3.37k stars 389 forks source link

Broken filename completion in eshell with Emacs 28.1 #2504

Open ikappaki opened 2 years ago

ikappaki commented 2 years ago

What happened?

Completion at point (hitting <TAB>) on a subpath replaces the subpath with the last subdirectory instead of completing

How to reproduce?

in Emacs 28.1, using the helm repo installed in d:/src as an example directory layout when trying to complete the helm/images path from Eshell:

  1. M-x eshell, opens the eshell prompt
    
    Welcome to the Emacs shell

d:/src $

2. Typing `helm/im<TAB>`, replaces `helm/im` with `images`

d:/src $ helm/im

d:/src $ images/


The expected behaviour (as in earlier Emacs versions) is to complete the path, e.g.:

d:/src $ helm/images/



### Helm Version

Master branch

### Emacs Version

Emacs-28/29

### OS

Windows

### Relevant backtrace (if possible)

_No response_

### Minimal configuration

- [X] I agree using a minimal configuration
thierryvolpiatto commented 2 years ago

I suggest you use helm-eshell instead of generic completion-at-point:

(cond ((= emacs-major-version 27)
       (define-key eshell-mode-map (kbd "TAB") 'helm-esh-pcomplete))
      ((= emacs-major-version 28)
       (define-key eshell-hist-mode-map (kbd "TAB") 'helm-esh-pcomplete))
      (t (define-key eshell-mode-map [remap eshell-pcomplete] 'helm-esh-pcomplete)))

See https://github.com/thierryvolpiatto/emacs-config/blob/main/init.el#L1600 for details. I will try to see anyway what's wrong with emacs-28 completion-at-point in eshell.

ikappaki commented 2 years ago

Thanks, it works with the slight addition of em-hist for eshell-hist-mode-map to become available:

(require 'em-hist)
(cond ((= emacs-major-version 27)
       (define-key eshell-mode-map (kbd "TAB") 'helm-esh-pcomplete))
      ((= emacs-major-version 28)
       (define-key eshell-hist-mode-map (kbd "TAB") 'helm-esh-pcomplete))
      (t (define-key eshell-mode-map [remap eshell-pcomplete] 'helm-esh-pcomplete)))
thierryvolpiatto commented 2 years ago

ikappaki @.***> writes:

What happened?

Completion at point (hitting ) on a subpath replaces the subpath with the last subdirectory instead of completing

How to reproduce?

in Emacs 28.1, using the helm repo installed in d:/src as an example directory layout when trying to complete the helm/images path from Eshell:

  1. M-x eshell, opens the eshell prompt

Welcome to the Emacs shell

d:/src $

  1. d:/src $ helm/im, replaces helm/im with `images'

d:/src $ images/

The expected behaviour (as in earlier Emacs versions) is to complete the path, e.g.:

d:/src $ helm/images/

Ok, I reproduced this bug (on Linux) and could fix it, however Emacs seems confused when completing such a filename without a leading meaningful shell command e.g. cd or ls, shell refuse to complete such path even with this fix, probably its completion-at-point-functions prevent this, don't know, anyway all others terms (xterm etc...) allow this. Note that pcomplete directly called from eshell complete this properly (Try C-c TAB), helm-eshell as specified in other post handle this also (you have better time always using this).

Will merge soon, looking if this fix doesn't trigger other bugs.

Thanks.

Helm Version

Master branch

Emacs Version

Emacs-28/29

OS

Windows

Relevant backtrace (if possible)

No response

Minimal configuration

• [*] I agree using a minimal configuration

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.*Message ID: @.***>

-- Thierry

thierryvolpiatto commented 2 years ago

Seems fixed now, closing.

thierryvolpiatto commented 2 years ago

I reverted the fix done here for now as it is not working with bash-completion (see #2532).