all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Brendan Leber <brendan@brendanleber.com>, help-gnu-emacs@gnu.org
Subject: RE: Extend Dired to Call a Function on a File?
Date: Wed, 12 Oct 2016 13:12:27 -0700 (PDT)	[thread overview]
Message-ID: <b16acf04-e9a1-4be8-ba4a-32cd56a93a68@default> (raw)
In-Reply-To: <CAC77Q0GrDNmV=2bc2VDd+emZy5wsf-YzzdtDx=HiFcXkmnEpWQ@mail.gmail.com>

> I have a function I've used to work on files that right now I call
> manually with M-x my-shiny-function RET my-shiny.file.  This works
> great for the one off file.  Yet I usually have to process batches of
> files in a given directory.  Being able to add a key binding to dired
> would be awesome as I'm already using dired on the directory to rename
> files and such.
> 
> I know enough elisp to add the key binding and write the function, I
> think.  The place I'm stuck is getting the file name as the first
> argument to the function when the binding is pressed.  Can anyone
> share some pointers to make this happen?

Not quite sure what you are asking.  You can of course use `M-!' to
act on the marked files using a shell command.

But I guess you are asking about mapping a Lisp function over files.

If you are asking about Dired then presumably you are talking about
acting on the marked files (else, why Dired?).  If so, and if you
use Dired+, then you can use `@', which is bound to command
`diredp-do-apply-function', to apply a Lisp function to each of the
marked files.

And you can, similarly, use `M-+ @', which is bound to
`diredp-do-apply-function-recursive', to do the same thing for the
marked files and the files in marked subdirs, for any number of
Dired buffers for descendent directories.

https://www.emacswiki.org/emacs/DiredPlus



  reply	other threads:[~2016-10-12 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 17:46 Extend Dired to Call a Function on a File? Brendan Leber
2016-10-12 20:12 ` Drew Adams [this message]
2016-10-12 20:36   ` Brendan Leber
2016-10-13  0:34     ` Drew Adams
2016-10-13 16:59       ` Brendan Leber
2016-10-12 20:18 ` Stephen Berman
2016-10-12 21:12 ` John Mastro

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

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

  git send-email \
    --in-reply-to=b16acf04-e9a1-4be8-ba4a-32cd56a93a68@default \
    --to=drew.adams@oracle.com \
    --cc=brendan@brendanleber.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.