evil
evil copied to clipboard
Error with C-w T on Emacs < 28
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 how about the fix in https://github.com/tomdl89/evil/commit/724a36222d5711546fff9dda188becfcb9fa9da5 ?
Is it not better to get an error that the command does not exist rather than that the keybinding does not exist?
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.
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...".