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)                                      

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) 

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
| improve this answer | |

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.

| improve this answer | |
  • 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 4: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 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.