[comp.emacs] isearch question

morgan@CHAOS.CS.BRANDEIS.EDU ("Dylan Kaufman") (03/15/91)

A user came to me the other day and asked me a question which has been
sitting in the back of my mind for a long time.

His question is:  why doesn't backspace shorten the search string and
backup so that it finds the shortened string?  Apparently it works
that way on all of his other copies of emacs (on his PC).  The effect
backspace would have is similar to the effect of pressing ^G when you
have NOT found a string because of the most recent character.  For
instance, if I type 'testinn' when I mean to type 'testing', if
'testinn' is not in the buffer, it says not found, and if I press ^G,
it goes back to 'testin' at which point I can press 'g' and find
'testing'.  If, on the other hand, 'testinn' IS in the buffer, it will
be found, and I will have to end the search with ^G and start again in
order to get to the same place I was before I pressed the second n (or
I could do ^a to get out of the isearch and do an backwards search on
'testin' and then make it a forward search again before pressing
'g'...)  

However, it would be nice if I could press backspace to have it remove
the most recently added character and back up one find.  Does such a
patch to isearch exist?  

Thanks for your help.



-<>Dylan<>-                     MA EMT-M, CA EMT-1A, BEMCo 107
Dylan Kaufman 			Major in Computer Science
morgan@chaos.cs.brandeis.edu	Brandeis University, Waltham, MA
------<< Support your local Emergency Medical Services >>-------
"Don't ask me, I'm just improvising" -RUSH

liberte@CS.UIUC.EDU (Daniel LaLiberte) (03/16/91)

Has anyone considered making the incremental searcher command(s)
into a minor mode?  This wouldnt help the problem of rebinding
the search-delete-char, for example, but it would unify the 
interface with the rest of emacs.

The more general problem is the binding of abstract keys (e.g.
delete-char) to functions rather than binding literal keys (e.g.
\b) to functions as is done now.  Any ideas?

dan

rms@MOLE.AI.MIT.EDU (Richard Stallman) (03/18/91)

    I've considered using a keymap rather than the current hard-wired ickiness.
    I think I'd still have it read the keys itself rather than just using the
    command loop, so you get what you want for C-g.

C-g is an ordinary command when read by the command loop; this keymap
could redefine it.  So perhaps the ordinary command loop could be used.

For the case where C-g is typed while a command is running, perhaps
the commands could check for quits itself using inhibit-quit.

If that doesn't work, then a recursive edit won't work either.  You
would need to read characters explicitly.  But you could still mimic
a mode.