5

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?

Patrick Steele
  • 1,125
  • 9
  • 10
  • 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. – Sean Allred Nov 04 '14 at 03:48
  • With only (require 'helm) (require 'helm-config) (require 'helm-files) (helm-mode 1) my commands work with Helm (tried from emacs -Q). – Patrick Steele Nov 04 '14 at 21:09
  • Interesting; I see what you mean. The above defun messages only the file under point when Helm exits. – Sean Allred Nov 04 '14 at 21:15

1 Answers1

3

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.

Tu Do
  • 6,812
  • 21
  • 39