[comp.emacs] Problem with Home key

wilensky@mite.aaet.ti.com (Harold Wilensky) (12/21/90)

Running emacs version 18.52 under X windows on Sun386i. If I do an
incremental search (c-s) and press the Home key (beginning-of-buffer)
after it finds what it is searching for, it inserts [214z into the
buffer rather than doing a beginning-of-buffer. The Home key works fine
otherwise. Usually, I press Home in this situation by accident and then
don't notice the garbage in my file until later.

I don't see this behavior when running under SunView.

Does anyone know how to prevent this? 

Please respond via e-mail.


Harold Wilensky |  e-mail: wilensky@aaet.csc.ti.com
512-250-6457    |     msg: WILN

pauld@scenic.wa.com (Paul Barton-Davis) (01/01/91)

Harold - 

many people have probably told you about this already. There is a
special character that Emacs uses to terminate an incremental search.
By default it is set to ESC. When you press the home key (or most any
other function key), it generates a sequence that begins with an ESC.
Emacs therefore terminates the search, and inserts the remaining part
of the generated sequence ("[214z") into the buffer, since it appears
to Emacs as if you typed each character one-by-one. You can prevent
this behaviour by putting the following in your .emacs file:

	(setq search-exit-char ?q)

which would set the "search exit character" to be a lower case q.
I seem to recall that I used to have a more sophisticated solution to
this that involved modifying the way that isearch handled its exit
character (sort of an "ungetc" approach), but I can't find it now.

Hope this helps,

Paul Barton-Davis			<pauld@scenic.wa.com>
ScenicSoft, Inc.	
(206) 776-7760		"Make it fast - soon to be pauld@home.com"