emacs-evil / evil

The extensible vi layer for Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ex command no longer completes command contain dash (-)

kiennq opened this issue · comments

Issue type

  • Bug report

Environment

Emacs version: GNU Emacs 30.0.50
Operating System: Windows 11
Evil version: 1.15.0
Evil installation type: MELPA
Graphical/Terminal: Graphical
Tested in a make emacs session (see CONTRIBUTING.md): Yes

Reproduction steps

  • Start Emacs
  • Enable evil, type :make- and press tab.

Expected behavior

All commands start with make- should be shown

Actual behavior

No matches

Further notes

Thiis is a regression of f84d345

@axelf4, it seems that your commit at f84d345 broke the evil's ex completion-at-point for commands that contain - character

it seems that your commit at f84d345 broke the evil's ex completion-at-point for commands that contain - character

Thanks for reporting the issue. However, it is not that simple, since arguably that commit fixed completion. The Ex command make- is parsed as a call to :make with - as the argument, because the prefix make is a valid Ex command (this logic is needed to parse e.g. substitute-foo- as a call to :substitute). This was always the case (please correct me if I am wrong). Thus - gets completed as a shell command, instead of make- getting completed as a command.

If you instead try to complete show-, where show is not a valid Ex command, then you will see that it does get completed as a command.

:make-frame will invoke the Emacs command M-x make-frame though (there's even a test case for that).
Well, admittedly I abused the evil Ex command ability of being able to invoke Emacs commands.

:make-frame will invoke the Emacs command M-x make-frame though (there's even a test case for that).

Yes, if there is an exact Emacs command match then that is preferred, even with a valid Ex command prefix (see this bit). To be clear, I consider the current situation less than ideal; you need to be allowed to write :substitute/.../ without a space between substitute and /.../, but :make/.../ does not make sense. That is what should be changed, commit f84d345 only improved completion such that the parsing detail became explicit.

Well, admittedly I abused the evil Ex command ability of being able to invoke Emacs commands.

I do that as well and would not consider it abuse. :)