summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-02-27 21:14:36 +0800
committerChong Yidong <cyd@gnu.org>2012-02-27 21:14:36 +0800
commitecf5f74e6bd8b74923513b504d8c3e5b49b91403 (patch)
treefef6911124cdbdd9620316870f93530fc2f1a0d0 /lisp/emulation
parent431ee44bbe15fa0b5d67cfb70df29e5d45039850 (diff)
downloademacs-ecf5f74e6bd8b74923513b504d8c3e5b49b91403.tar.gz
Fix M-x in Viper mode.
* lisp/emulation/viper-cmd.el (viper-intercept-ESC-key): Fix key-binding lookup for ESC key. Fixes: debbugs:9146
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-cmd.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 503fd2c66d5..68f40349454 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -1086,8 +1086,17 @@ as a Meta key and any number of multiple escapes are allowed."
(defun viper-intercept-ESC-key ()
"Function that implements ESC key in Viper emulation of Vi."
(interactive)
- (let ((cmd (or (key-binding (viper-envelop-ESC-key))
- (lambda () (interactive) (error "Viper bell")))))
+ ;; `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* ((event (viper-envelop-ESC-key))
+ (cmd (cond ((equal event viper-ESC-key)
+ 'viper-intercept-ESC-key)
+ ((let ((emulation-mode-map-alists nil))
+ (key-binding event)))
+ (t
+ (error "Viper bell")))))
;; 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