[comp.emacs] Query-replace-regexp suggestion

ram-ashwin@YALE.ARPA (Ashwin Ram) (03/07/88)

It would be nice if query-replace-regexp (and query-replace too, I suppose)
did an isearch in the window while you were typing in the pattern in the
minibuffer-window.  In other words, when it prompts you for the pattern to be
replaced, it should go back to the current buffer and do an isearch as you
type in the pattern (which is echoed in the minibuffer).  This would make it
a lot easier to type in complicated patterns for replacement, as well as save
you typing in a pattern and its replacement if there is no occurrence of that
pattern in the buffer (e.g., if you mistyped something).

I wonder how hard it would be to have it make your replacement at the first
occurrence of the pattern in the current buffer as you type it in in the
minibuffer.  This would be really cool!  But even just the first part (which
should be easier) would be very useful.

If anyone has done this, or can suggest a way to do it, please let me know.
Thanks.

-- Ashwin Ram --

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs

wolfgang@MGM.MIT.EDU (Wolfgang Rupprecht) (03/07/88)

I like the incremental query-replace* suggestion. 

The isearch-* family of commands already do the desired cursor motion.
It shouldn't be to hard to use these to write a purely lisp routine to
do incremantal-replace-*. One would have to devise an intuitive way of
toggling to/from "add-to-regexp-in-the-minibuffer" mode and
"replace-this-match" mode. [Sure emacs is modeless ...]

---
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
326 Commonwealth Ave.	UUCP:  mit-eddie!mgm.mit.edu!wolfgang
Boston, Ma. 02115	TEL:   (617) 267-4365