From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Colin S. Miller" Newsgroups: gmane.emacs.help Subject: Re: need help with editing multiple files in a directory Date: Thu, 19 Jul 2007 23:49:24 +0100 Organization: SunSITE.dk - Supporting Open source Message-ID: <469fea75$0$90263$14726298@news.sunsite.dk> References: <1184860347.592401.221020@22g2000hsm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1184890385 31624 80.91.229.12 (20 Jul 2007 00:13:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jul 2007 00:13:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 20 02:13:03 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IBg7C-0002xo-Hd for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Jul 2007 02:13:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IBg7B-0002dL-VT for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Jul 2007 20:13:02 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.szn.dk!pnx.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail User-Agent: Icedove 1.5.0.12 (X11/20070607) Original-Newsgroups: gnu.emacs.help In-Reply-To: <1184860347.592401.221020@22g2000hsm.googlegroups.com> Original-Lines: 47 Original-NNTP-Posting-Host: 62.56.78.124 Original-X-Trace: news.sunsite.dk DXC=J>PibF[QLHW5dE91CT5^XYYSB=nbEKnk[BeW^X3\7QfSG1[Bg<0aH5P\VT\m5_SIbVU_42Df:PaKXTcL2h5ahoT_kF_>m>CYcV_ZSXmin]2HYP1WINhidUA[Xd< 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:45820 Archived-At: bittna@gmail.com wrote: > Hello, > I have multiple files in a directory that need a line added at a > certain point in the file. I wrote a lisp expression to do it, but I > have to load the file, then run the command on the buffer, the save > the file and I lose my place. I used dired to do a find and replace > on all of the files I needed, but how do I run my lisp expression on > all of the files? > > Also how do I loop through all the buffers using lisp and switch into > each buffer and do something, then move to the next buffer? > > Thanks!!! > Bittna, The function (dired-get-marked-files) looks interesting. I don't speak lisp well, so this mightn't be the best way of doing things. (loop for fileName in (dired-get-marked-files) do (progn (find-file fileName) (bittna-lisp-expr))) or (loop for fileName in (dired-get-marked-files) do (let ((buff)) (progn (setq buff (find-file fileName)) (bittna-lisp-expr)) (kill-buffer buff))) I use XEmacs, rather than GNU Emacs, so YMMV. HTH, Colin S. Miller -- Replace the obvious in my email address with the first three letters of the hostname to reply.