From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.help Subject: Re: Search and replace in all buffers Date: Mon, 23 Jan 2006 04:28:22 +0200 Organization: SunSITE.dk - Supporting Open source Message-ID: <861wyzbruh.fsf@flame.pc> References: <2520975.post@talk.nabble.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137983570 27320 80.91.229.2 (23 Jan 2006 02:32:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2006 02:32:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 23 03:32:49 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F0rVf-0003k4-3V for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2006 03:32:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F0rYH-00089v-8Y for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Jan 2006 21:35:29 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!news.glorb.com!dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:KORFSs6htCVn5g2KFk5wB7A3H5A= Original-Lines: 30 Original-NNTP-Posting-Host: 81.186.70.52 Original-X-Trace: news.sunsite.dk DXC=NXK_n3OH9heVPh8EAZ[i2lYSB=nbEKnkk3InNh=l7?FoL^MjgX7f^UIZ@YZi8b_\VXNZ]7hd269C2aE4le Original-X-Complaints-To: staff@sunsite.dk Original-Xref: shelby.stanford.edu gnu.emacs.help:137165 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32786 Archived-At: On Sun, 22 Jan 2006 14:23:43 -0800 (PST), "AndyJB (sent by 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))))