evil icon indicating copy to clipboard operation
evil copied to clipboard

Error with C-w T on Emacs < 28

Open Tekki opened this issue 2 years ago • 5 comments
trafficstars

Issue type

  • Bug report

Environment

Emacs version: 27.1 Operating System: Debian Bullseye Evil version: 1.15.0 Evil installation type: Melpa Graphical/Terminal: Yes

Reproduction steps

  • Start Emacs
  • Open 2 buffers in 2 windows
  • Press C-w T

Expected behavior

Buffer should be moved to a new tab, or nothing should happen.

Actual behavior

Error message: "Wrong type argument: commandp, tab-window-detach"

Further notes

tab-window-detach only exists in Emacs >= 28. We should probably check for the existence of the function instead of the feature in evil-maps.el:

(when (featurep 'tab-bar)
  (define-key evil-window-map "T" 'tab-window-detach))

Tekki avatar Jul 17 '23 09:07 Tekki

@Tekki how about the fix in https://github.com/tomdl89/evil/commit/724a36222d5711546fff9dda188becfcb9fa9da5 ?

tomdl89 avatar Jul 20 '23 21:07 tomdl89

@Tekki how about the fix in tomdl89@724a362 ?

Looks good. Tested on 27 and 28.

Tekki avatar Jul 21 '23 07:07 Tekki

Is it not better to get an error that the command does not exist rather than that the keybinding does not exist?

axelf4 avatar Jul 21 '23 12:07 axelf4

Possibly, but "Wrong type argument: commandp, tab-window-detach" isn't super clear to many users, and there are plenty of vim commands that we haven't implemented yet, which appear as undefined keybinding messages instead of "command does not exist" sort of messages.

tomdl89 avatar Jul 21 '23 13:07 tomdl89

Only a meaningful message would be a real solution. At the moment, if we don't bind C-w T, C-w t will be used instead and evil-window-top-left called. This is probably as confusing for the user as "Wrong type argument...".

Tekki avatar Jul 22 '23 06:07 Tekki