From: kgallagh@digi.lonestar.org (Kevin Gallagher)
Newsgroups: comp.emacs
Subject: Re: repetetive search with function keys
Date: 23 Nov 92 00:06:47 GMT
Distribution: usa
Organization: DSC Communications Corp, Plano, TX

In article <1992Nov21.183024.19520@umbc3.umbc.edu> steibel@venus.cs.umbc.edu (David M. Steibel) writes:
>sastr_a@ptah.cs.odu.edu (RAVI AYYALASOMAYAJULA) writes:
>
>> My question is how do I make my fuction key search repetitively search
>> for the search the same string?
>
>You would want to bind it to isearch-forward, and isearch-backwards.

The function "isearch-backward" does not have an "s" at the end of the name.

>Note that isearch-forward is sometimes already bound to control-s,
>except when control-s is used for flow control purposes.  Sometimes
>isearch-forward is bound to control-backslash also.

This particular "binding" is usually accomplished via the keyboard translate
table, not by re-binding isearch-forward to C-\.  (See the GNU Emacs Lisp
Reference Manual, Edition 1.03, for more information on the use of translate
tables.) 

>[stuff deleted]
>control-d ends the process, as does moving around with the
>cursor keys.

This is sometimes NOT true.  Actually, the default character used to end an
isearch is ESC, which is specified in the variable "search-exit-char".
Control-d usually works as an exit character because the variable
"search-exit-option" is set to "t", by default, meaning "random control
characters terminate incremental search".  No doubt your arrow keys generate
control characters, none of which mean anything special to isearch, so isearch
treats it as random and exits when one of them is pressed.  However, if you
are using a VT100 terminal, the arrow keys generate escape sequences like
ESC-OA, yielding unexpected results.  For example, pressing the up-arrow key
will exit isearch with the first character ESC, but then the characters OA
will be entered into the buffer; not exactly what the user had in mind!

On the other hand, if GNU Emacs were installed at your site with the variable
search-exit-char set to C-d, then the arrow keys on a VT100 will NOT exit
isearch at all.  Isearch will try to search for them, instead.

>Also, if you have finished your search string, and wish to find the second
>occurance of your search string, press the isearch key again.

If you rebind isearch-forward to something other than C-s, pressing this new
key to search again will NOT work unless you have set the variable
"search-repeat-char" to the character generated by the new key used to invoke
isearch-forward.  Unfortunately, setting this variable to more than a single
character is NOT supported within the isearch-forward function.  This means,
if you bind isearch-forward to a function key that generates a
multiple-character sequence, you cannot use that same function key to repeat
the search for the same string (without getting inside and hacking the
isearch-forward code).  (By the way, the corresponding repeat variable for
isearch-backward is search-reverse-char.)

-- 
----------------------------------------------------------------------------
Kevin Gallagher        kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
DSC Communications Corporation   Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
----------------------------------------------------------------------------
Xref: sparky comp.emacs:3571 gnu.emacs.help:4845