Function: viper-intercept-ESC-key

viper-intercept-ESC-key is an interactive and byte-compiled function defined in viper-cmd.el.gz.

Signature

(viper-intercept-ESC-key)

Documentation

Function that implements ESC key in Viper emulation of Vi.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
;; Listen to ESC key.
(defun viper-intercept-ESC-key ()
  "Function that implements ESC key in Viper emulation of Vi."
  (interactive)
  ;; `key-binding' needs to be called in a context where Viper's
  ;; minor-mode map(s) have been temporarily disabled so the ESC
  ;; binding to viper-intercept-ESC-key doesn't hide the binding we're
  ;; looking for (Bug#9146):
  (let* ((cmd 'viper-intercept-ESC-key))

    ;; call the actual function to execute ESC (if no other symbols followed)
    ;; or the key bound to the ESC sequence (if the sequence was issued
    ;; with very short delay between characters).
    (if (eq cmd 'viper-intercept-ESC-key)
	(setq cmd
	      (cond ((eq viper-current-state 'vi-state)
		     'viper-ESC)
		    ((eq viper-current-state 'insert-state)
		     'viper-exit-insert-state)
		    ((eq viper-current-state 'replace-state)
		     'viper-replace-state-exit-cmd)
		    (t 'viper-change-state-to-vi)
		    )))
    (call-interactively cmd)))