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

(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?


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.

| improve this answer | |
  • Hard programming did it. That was quite trivial. Thank you – user168651 Apr 14 '19 at 6: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 6:30

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.