[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Search and replace in all buffers
From: |
Giorgos Keramidas |
Subject: |
Re: Search and replace in all buffers |
Date: |
Mon, 23 Jan 2006 04:28:22 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix) |
On Sun, 22 Jan 2006 14:23:43 -0800 (PST),
"AndyJB (sent by Nabble.com)" <lists@nabble.com> wrote:
> Drew Adams wrote:
> http://www.emacswiki.org/cgi-bin/wiki/CategorySearchAndReplace
>
> Thanks - there are a couple of things there that might be close to what
> I'm looking for - grep-buffers and moccur-edit look useful. I'll give them
> a try. It surprises me that something this obvious (to me) isn't part of
> standard Emacs - other editors I've used before moving to Emacs had it.
It's easy enough to implement with something like this, though:
| (dolist (elt (mapcar (function buffer-name) (buffer-list)) nil)
| (save-current-buffer
| (set-buffer elt)
| (if (not buffer-read-only)
| (progn ...))))
A friend of mine used the following to reindent many XML/HTML files and
was kind enough to share it:
| (defun indent-all-buffers ()
| "Reindent all currently open buffers, as long as they are
| not read-only. Read-only buffers are simply skipped."
| (interactive)
| (dolist (elt (mapcar (function buffer-name) (buffer-list)) nil)
| (save-current-buffer
| (set-buffer elt)
| (if (not buffer-read-only)
| (indent-region (point-min) (point-max) nil))))