5

I've recently shifted to Emacs + Evil for my dev setup, and seem to be running into a rather strange issue with Emacs 24: when I exit Insert mode using Ctrl+[ and try to save the file with :w, Emacs enters the debugger with this error message:

Debugger entered--Lisp error: (void-variable w)                                    
eval(w nil)                                                                      
eval-expression(w nil)                                                           
call-interactively(eval-expression nil nil)                                      
command-execute(eval-expression)   

This does not happen if I pause for a few seconds after Ctrl+[. This also appears to be restricted only to Emacs in terminal - this happens quite frequently on bash/Cygwin, but never happens on the standalone version of Emacs

Does anyone know what could be going wrong? I have this configuration in my .emacs foe evil mode:

(setq evil-want-C-i-jump nil) 
(require 'evil) 
(evil-mode t) 
Popeko
  • 91
  • 5

2 Answers2

4

It turns out this was just due to a TMUX setting (forgot to mention I'm always inside a tmux session), got it working with this setting (from https://stackoverflow.com/questions/12312178/tmux-and-vim-escape-key-being-seen-as-and-having-long-delay/13843382#13843382)

set -s escape-time 0
Popeko
  • 91
  • 5
1

This is because Emacs allows using the escape key in place of meta to support it in terminals. To tell the sequence ESC : apart from M-:, you must either use the GUI or check the delay between them, if it's greater than a given threshold (as seen in evil-esc-delay), it's considered the former. This is a somewhat fragile solution as it breaks apart when introducing extra layers, like a SSH session. It's recommended to use the GUI at all times.

wasamasa
  • 22,178
  • 1
  • 66
  • 99
  • Thanks! It seems however the issue was due to a tmux issue, got it working by setting the escape time there (forgot to mention I was running in Tmux) – Popeko Feb 26 '18 at 04:24
  • Well, that's one of the layers I was hinting at. Glad you managed to find the error source! – wasamasa Feb 26 '18 at 06:25