Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!CS.BROWN.EDU!kgk From: kgk@CS.BROWN.EDU Newsgroups: gnu.emacs.bug Subject: suggestion for addition to query replace Message-ID: <8911131642.AA11330@aruba.cs.brown.edu> Date: 13 Nov 89 16:42:28 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: kgk@cs.brown.edu (Keiji Kanazawa) Distribution: gnu Organization: GNUs Not Usenet Lines: 48 I would like to propose the addition of new functionality to query replacement functions so that a user can change the replacement string/regexp during the query replacement. By replacement string/regexp, I mean the string/regexp to replace with, not the string/regexp being replaced. This comes in handy on occasions such as the following. You duplicate a function definition or paragraph three times. In the first copy, you replace all occurrences of x by y, and in the second all occurrences of x by z, and so on. The suggested change can be implemented by the following. I selected C-c as the command character to stand for change, but of course, you are welcome to change it as you see fit. Keiji Kanazawa diff -c replace.el-dist replace.el *** replace.el-dist Mon Nov 13 11:27:28 1989 --- replace.el Mon Nov 13 11:30:06 1989 *************** *** 202,207 **** --- 202,208 ---- C-r to enter recursive edit (\\[exit-recursive-edit] to get out again), C-w to delete match and recursive edit, C-l to clear the screen, redisplay, and offer same replacement again, + C-c to replace the string or regexp to replace with, ! to replace all remaining matches with no more questions, ^ to move point back to previous match." "Help message while in query-replace") *************** *** 282,287 **** --- 283,296 ---- ((or (= char ?\177) (= char ?n)) (setq done t)) + ((= char ?\C-c) + (setq to-string + (read-from-minibuffer (concat "Query replace " + (if regexp-flag + "regexp " + "") + from-string + " with: ")))) ((= char ?\C-l) (recenter nil)) ((= char ?\C-r)