unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: need help with editing multiple files in a directory
Date: Thu, 19 Jul 2007 23:49:24 +0100	[thread overview]
Message-ID: <469fea75$0$90263$14726298@news.sunsite.dk> (raw)
In-Reply-To: <1184860347.592401.221020@22g2000hsm.googlegroups.com>

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.

  parent reply	other threads:[~2007-07-19 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 15:52 need help with editing multiple files in a directory bittna
2007-07-19 16:24 ` Pascal Bourguignon
2007-07-19 20:55 ` Joel J. Adamson
2007-07-19 22:49 ` Colin S. Miller [this message]
2007-07-20  5:33 ` Mathias Dahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='469fea75$0$90263$14726298@news.sunsite.dk' \
    --to=no-spam-thank-you@csmiller.demon.co.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).