Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!uunet!fernwood!oracle!news From: wmesard@oracle.com (Wayne Mesard) Newsgroups: comp.emacs Subject: Re: Multi-file replace (unconditional) Message-ID: <1991Jan8.072529.18560@oracle.com> Date: 8 Jan 91 07:25:29 GMT References: <3617@archive.BBN.COM> Reply-To: wmesard@oracle.com (Wayne Mesard) Organization: Oracle Corporation, Belmont CA Lines: 30 nat%DRAO.NRC.CA@VM.TCS.TULANE.EDU (Natalie Prowse) writes: >Hi, I am looking for a function to do an unconditional replace on >every file/buffer that I have loaded in my current emacs session. [...] >Has someone written such a beast [for GNU Emacs]? Piece o cake: ;; WMesard@Oracle.COM 1/7/90 (defun replace-string-all-buffers (from-string to-string &optional delimited) "Invoke replace-string on every part of every goll-darn buffer." (interactive "sReplace string: \nsReplace string %s with: \nP") (let ((bufs (buffer-list))) (while bufs (set-buffer (car bufs)) (goto-char (point-min)) (replace-string from-string to-string delimited) (setq bufs (cdr bufs)) )) ) Now that I've given you the tool of your own destruction, let me ask you: Are you sure this is what you want? Have you tried tags-query-replace? Do you know that typing a bang ("!") during query replace will silently replace all the remaining matches in that buffer? That's always been powerful enough for me (and I like to change variable and typedef names a lot). -- Wayne(); WMesard@Oracle.COM