[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Extend Dired to Call a Function on a File?

From: Drew Adams
Subject: RE: Extend Dired to Call a Function on a File?
Date: Wed, 12 Oct 2016 13:12:27 -0700 (PDT)

> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]