[gnu.emacs] meta keys and esc prefixing

jbw@bucsf.bu.edu (Joe Wells) (09/07/89)

In article <11826@cit-vax.Caltech.Edu> mazer@bek-owl.caltech.edu (Jamie Mazer) writes:

    Now that I've got access to a keyboard with a real meta key (NCD X-term),
   I've noticed something wierd with gnuemacs 18.52. If I type:
	   "C-S <search-string> M-V" (C-S bound to forward-i-search)\
    The i-search proceeds normally, but instead of M-V terminating the search
   and moving forward a screen - it gets read as <esc>V - in which case the esc
   terminates and the V gets inserted into the buffer - even though I use the
   meta key on the keyboard. I noticed this problem previously with non-meta
   terminals (vt100s), but figured it would be fixed on a "nice" terminal which
   sends eigth-bit info.
    Is this a known bug? (Or perhaps feature ;-) Does anyone have a workaround?
   It would be nice if i-search were smarter about gobbling the esc so quickly.

According to the comments in various places in the source code, isearch
should handle this correctly.  If you can use the lisp debugger, you might
want to check what values isearch is getting from read-char.

However, I am including fix that handles (on my machine) the general
problem of ESC being both the isearch terminator and a prefix for function
keys.  Apply this fix and isearch will divine whether you typed a single
ESC character, or a function key that generates ESC as a prefix.

Enjoy!

--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw
----------------------------------------------------------------------
*** /usr14/gnu/dist-18.52/lisp/isearch.el	Tue Dec  8 18:11:03 1987
--- new-isearch.el	Wed Sep  6 19:50:24 1989
***************
*** 117,123 ****
  		  ;; Esc means exit search normally.
  		  ;; Except, if first thing typed, it means do nonincremental
  		  (if (= 0 (length search-string))
! 		      (nonincremental-search forward regexp))
  		  (throw 'search-done t))
  		 ((= char ?\C-g)
  		  ;; ^G means the user tried to quit.
--- 117,125 ----
  		  ;; Esc means exit search normally.
  		  ;; Except, if first thing typed, it means do nonincremental
  		  (if (= 0 (length search-string))
! 		      (nonincremental-search forward regexp)
! 		    (if (input-pending-p)
! 			(setq unread-command-char char)))
  		  (throw 'search-done t))
  		 ((= char ?\C-g)
  		  ;; ^G means the user tried to quit.