From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Macros in dired - Is it possible?
Date: Sun, 19 Jul 2009 09:04:04 -0700 (PDT) [thread overview]
Message-ID: <efa207a1-64e2-4afa-8113-fcf8c74cf922@x6g2000prc.googlegroups.com> (raw)
In-Reply-To: 75b2b979-ef00-4ec9-9d3b-76625aa3ffbc@i4g2000prm.googlegroups.com
On Jul 18, 7:29 pm, zeek <zp1z...@gmail.com> wrote:
> Thank you Anselm Helbig and Muede for the functions
>
> Looking forward to trying them out. Already learning more Lisp. There
> is no way I could have come up with them.
>
> Now I understand why I couldn't get the macros to save & kill the
> buffer - makes sense. Well written.
>
> Thank you again for responding so quickly with your solutions.
>
> Cheers
To apply a function to marked files in dired, use “dired-get-marked-
files”, like this:
;; idiom for processing a list of files in dired's marked files
;; suppose myProcessFile is your function that takes a file path
;; and do some processing on the file
(defun dired-myProcessFile ()
"apply myProcessFile function to marked files in dired."
(interactive)
(require 'dired)
(mapc 'myProcessFile (dired-get-marked-files))
)
See:
• Emacs Lisp Idioms
http://xahlee.org/emacs/elisp_idioms.html
you just need to write the myProcessFile function ... it's pretty easy
to do what you want. The function should open the file, use search-
forward to move cursor to the place of the word, then delete that
paragraph, repeat, then save the file. I'd say this code would be less
than 20 or 30 lines, and will take (me) about 20 min.
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2009-07-19 16:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.2744.1247896840.2239.help-gnu-emacs@gnu.org>
2009-07-18 9:14 ` Macros in dired - Is it possible? Xah Lee
2009-07-18 17:19 ` zeek
2009-07-18 21:10 ` Anselm Helbig
2009-07-18 21:02 ` muede
2009-07-18 21:08 ` Anselm Helbig
2009-07-19 2:29 ` zeek
2009-07-19 16:04 ` Xah Lee [this message]
2009-07-17 18:41 zeek peters
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=efa207a1-64e2-4afa-8113-fcf8c74cf922@x6g2000prc.googlegroups.com \
--to=xahlee@gmail.com \
--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).