Search code examples
elisp

elisp, pass arguments but specify optional


(defun helm-do-ag (&optional basedir targets default-input)

I want to call the above function with default-input, leaving basedir targets empty

Do I call (helm-do-ag nil nil "something") ?


Solution

  • Correct. Unspecified optional arguments get the value nil by default, and so passing nil for them explicitly is no different.