Subject: bug#9146: M-x broken in console mode with viper (always gives: "viper bell"))

From: Chong Yidong <[email-masked]>
Date: Mon, 27 Feb 2012 18:12:43 +0800

Stefan Monnier <[email-masked]> writes:

> IOW viper-intercept-ESC-key needs to be changed to call key-binding 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 thing
> we're looking for.

Since no one else has stepped up to the plate, I took a crack at this.

Stefano, could you test if the following patch does the right thing?

*** lisp/emulation/viper-cmd.el	2012-01-19 07:21:25 +0000
--- lisp/emulation/viper-cmd.el	2012-02-27 10:10:42 +0000
***************
*** 1086,1093 ****
  (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")))))
  
      ;; 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
--- 1086,1098 ----
  (defun viper-intercept-ESC-key ()
    "Function that implements ESC key in Viper emulation of Vi."
    (interactive)
!   (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