Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken filename completion in eshell with Emacs 28.1 #2504

Open
1 task done
ikappaki opened this issue Apr 22, 2022 · 5 comments
Open
1 task done

Broken filename completion in eshell with Emacs 28.1 #2504

ikappaki opened this issue Apr 22, 2022 · 5 comments
Labels

Comments

@ikappaki
Copy link

ikappaki commented Apr 22, 2022

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 $
  1. Typing helm/im<TAB>, replaces helm/im with images
d:/src $ helm/im<TAB>
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

  • I agree using a minimal configuration
@ikappaki ikappaki added the bug label Apr 22, 2022
@thierryvolpiatto
Copy link
Member

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
Copy link
Author

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
Copy link
Member

thierryvolpiatto commented Jun 19, 2022 via email

thierryvolpiatto added a commit that referenced this issue Jun 20, 2022
This fix the default eshell completion based on completion-at-point
which fails to complete a filename not preceded by a meaningful
command like cd or ls.
Pcomplete and helm-eshell are working properly in this case.

Problem is that the base-size returned by completion-all-completions
in this case is always zero (seems it assume we are trying to complete
a command even if the metadata specify a file completion)

To fix it we try here to recalculate the base-size from the last / found.
@thierryvolpiatto
Copy link
Member

Seems fixed now, closing.

@thierryvolpiatto
Copy link
Member

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

thierryvolpiatto added a commit that referenced this issue Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants