Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!xanth!talos!kjones From: kjones@talos.uu.net (Kyle Jones) Newsgroups: comp.emacs Subject: Re: simulaneous replacement ? Message-ID: <1990Feb3.222730.2705@talos.uu.net> Date: 3 Feb 90 22:27:30 GMT References: <1962@gmdzi.UUCP> Reply-To: kyle@xanth.cs.odu.edu Lines: 29 Georg Wittig writes: > Is it possible in EMACS to replace several strings simulaneously? I.e. > if I want to replace all the 'abc's by 'xyz's and all the 'Ag's by 'Tr's and > all the 'E's by 'e's and all the ... See what I mean? > > Sure, I can > M-< M-x replace-string ... > M-< M-x replace-string ... > etc. > > But that's much to type, and error-prone. You must be complaining about having to retype "M-< M-x replace-string", since you'll have to type all the search and replacement strings anyway. There are a few things that you can do. 1. Bind replace-string to a key. 2. Instead of typing M-< before each replace pass, use C-u C-@, which may be easier to type on your terminal. (On some terminals C-@ can be generated by typing CTRL-SPACE, which is consderable easier than any META_SHIFT combination.) Since replace-string pushes point onto the mark ring before it starts searching, C-u C-@ will pop this position and you'll be back to where you where before the replace. 3. Use C-x ESC (repeat-complex-command) and edit the replace strings from the previous invocation of replace-string. I wouldn't advise this one unless you understand basic Lisp syntax.