1

I use emms to play music in emacs and I have this function to add a music directory and shuffle it.

(defun my-emms-command()                                    
  "Run `emms-add-directory' and `emms-shuffle' in sequence."
  (interactive)                                             
  (emms-add-directory)                                      
   (emms-shuffle))

(global-set-key (kbd "s-m a") 'my-emms-command)

But calling on this command returns "wrong number of argumets"

How do I fix this?

Drew
  • 75,699
  • 9
  • 109
  • 225
user168651
  • 53
  • 3

1 Answers1

1

I don't know about emms but... Basically you either hard-code the required argument :

(emms-add-directory "foo")

or pass it with the wrapping function:

(defun my-emms-command(directory)
,,,
(emms-add-directory directory)
,,,

Look at the doc of the specific functions you are using to find out what datatype your argument must be.
BTW, in the case of not hard-coding the directory path, you will need to rethink the user call with a keybinding.

manandearth
  • 2,068
  • 1
  • 11
  • 23
  • Hard programming did it. That was quite trivial. Thank you – user168651 Apr 14 '19 at 06:18
  • hard-coding is not the best practice. But if it's what you want to use, I'd recommend having a function name that declares clearly that it is hard-coded, something like `emms-foo-shuffle` – manandearth Apr 14 '19 at 06:30