Function: evil-esc-mode

evil-esc-mode is a byte-compiled function defined in evil-core.el.

Signature

(evil-esc-mode &optional ARG)

Documentation

Toggle interception of \e (escape).

Enable with positive ARG and disable with negative ARG.

When enabled, evil-esc-mode(var)/evil-esc-mode(fun) modifies the entry of \e in input-decode-map. If such an event arrives, it is translated to a plain escape event if no further event occurs within evil-esc-delay seconds. Otherwise no translation happens and the ESC prefix map (i.e. the map originally bound to \e in
`input-decode-map`) is returned.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-core.el
;; The ESC -> escape translation code has been provided by Stefan
;; Monnier in the discussion of GNU Emacs bug #13793.
(defun evil-esc-mode (&optional arg)
  "Toggle interception of \\e (escape).
Enable with positive ARG and disable with negative ARG.

When enabled, `evil-esc-mode' modifies the entry of \\e in
`input-decode-map'. If such an event arrives, it is translated to
a plain `escape' event if no further event occurs within
`evil-esc-delay' seconds. Otherwise no translation happens and
the ESC prefix map (i.e. the map originally bound to \\e in
`input-decode-map`) is returned."
  (cond
   ((or (null arg) (eq arg 0))
    (evil-esc-mode (if evil-esc-mode -1 +1)))
   ((> arg 0)
    (unless evil-esc-mode
      (setq evil-esc-mode t)
      (add-hook 'after-make-frame-functions #'evil-init-esc)
      (mapc #'evil-init-esc (frame-list))))
   ((< arg 0)
    (when evil-esc-mode
      (remove-hook 'after-make-frame-functions #'evil-init-esc)
      (mapc #'evil-deinit-esc (frame-list))
      (setq evil-esc-mode nil)))))