Dired lets me mark files and pass their names as arguments to arbitrary shell commands. I would like a way to supply the marked names as arguments to Emacs Lisp functions, either built-in or those I write myself.

1 Answer 1


Just use function dired-get-marked-files. It gives you a list of the marked file and directory names. And then just use funcall or apply to pass them to a function.

(You can also use w in Dired to copy the marked names, separated by spaces, to a (single) string on the kill-ring, which you can then yank to insert them as a group wherever you want.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.