[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replacing text in multiple buffers
From: |
lawrence mitchell |
Subject: |
Re: Replacing text in multiple buffers |
Date: |
Thu, 03 Jul 2003 22:50:01 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 |
Mark Redar wrote:
> Hi all,
> I'm searching for a way to replace text in all the
> buffers currently open, a global replace for all
> buffers.
> Is there a way to have a command operate on all the
> open buffers???
You could possibly utilise something like:
(defun map-buffers (function regexp)
"Call FUNCTION on all buffers matching REGEXP."
(dolist (buffer (buffer-list))
(when (string-match regexp (buffer-name buffer))
(funcall function buffer))))
You might then do something like:
(map-buffers #'some-function-to-replace "\\.c$"), to replace in
all buffers whose filename ends in .c.
I'm sure I've missed some builtin command though.
--
lawrence mitchell <wence@gmx.li>