12

I have a command called test which simply takes an input from the user and echoes it back:

(defun test (input)
  (interactive "MInput: ")
  (message "%s" input))

I want to write another function which would call it. The following fails:

(defun test-forward ()
  (interactive)
  (test))

with this error

test-forward: Wrong number of arguments: (lambda (input) (interactive "MInput: ") (message "%s" input)), 0

This makes sense, since test takes one input. Making test's input &optional simply makes test-forward return nil without doing anything. What is the right way of doing this?

13

Simply:

(call-interactively 'test)

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.