If I write a command that calls (interactive "f"), Emacs will prompt the user to select a file when the command is run interactively. With Helm enabled, this selection is done through Helm with no additional effort -- this is great!

However, if I mark multiple files in the Helm selection window, it is not clear to me that this information is passed on to the command. Is there a way to get custom commands to cooperate with Helm and multiple selections?

  • Are you sure about the 'no additional effort' bit? I just recently installed Helm and (defun my-test (files) (interactive "f") (message "%S" files)) isn't invoking Helm for me. Nov 4 '14 at 3:48
  • With only (require 'helm) (require 'helm-config) (require 'helm-files) (helm-mode 1) my commands work with Helm (tried from emacs -Q). Nov 4 '14 at 21:09
  • Interesting; I see what you mean. The above defun messages only the file under point when Helm exits. Nov 4 '14 at 21:15

If you want to pass multiple selections, you have to explicitly retrieve:

(helm-marked-candidates :with-wildcard t)

and explicitly process the selections. Try printing the return value of the above form to see if you get correct set of candidates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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