]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix M-x in Viper mode.
authorChong Yidong <cyd@gnu.org>
Mon, 27 Feb 2012 13:14:36 +0000 (21:14 +0800)
committerChong Yidong <cyd@gnu.org>
Mon, 27 Feb 2012 13:14:36 +0000 (21:14 +0800)
* lisp/emulation/viper-cmd.el (viper-intercept-ESC-key): Fix
key-binding lookup for ESC key.

Fixes: debbugs:9146
lisp/ChangeLog
lisp/emulation/viper-cmd.el

index cc846534a1c9971f4ff46d4f6b27da3822bbe92c..5b822cc1cdb35d7f3e989bc748ed4afd60f97b9d 100644 (file)
@@ -1,5 +1,8 @@
 2012-02-27  Chong Yidong  <cyd@gnu.org>
 
+       * emulation/viper-cmd.el (viper-intercept-ESC-key): Fix
+       key-binding lookup for ESC key (Bug#9146).
+
        * font-lock.el (font-lock-specified-p): Rename from
        font-lock-spec-present.  Callers changed.
 
index 503fd2c66d5397dff6a0bf368f695aafacdd336b..68f40349454e4d0ba71090ce6b61d5ae1f9db9e6 100644 (file)
@@ -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