Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!mit-eddie!YALE.ARPA!ram-ashwin From: ram-ashwin@YALE.ARPA (Ashwin Ram) Newsgroups: comp.emacs Subject: Re: (treat-as-single-undo) Message-ID: <8709081530.AA24182@ATHENA.CS.YALE.EDU> Date: Tue, 8-Sep-87 11:30:47 EDT Article-I.D.: ATHENA.8709081530.AA24182 Posted: Tue Sep 8 11:30:47 1987 Date-Received: Wed, 9-Sep-87 04:36:25 EDT Sender: daemon@eddie.MIT.EDU Lines: 24 > Often, I would like to 'chunk' a large group of changes as a single 'undo' > action. E.g. if I replace-regexp several lines, I'd like to be able to > 'undo' the lot of them, not each one. I don't know about chunking undoes in general, but for the replace-regexp case, simply replace your use of: (replace-regexp regexp to-string) by the following: (while (re-search-forward pattern) (replace-match replacement t)) This chunk of code will undo in one step, whereas replace-regexp undoes each replacement one by one. The second form has the additional advantage that you can use the optional arguments to re-search-forward and replace-match if you want to. -- Ashwin Ram -- ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,linus,seismo}!yale!Ram-Ashwin BITNET: Ram@yalecs