Take the 2-minute tour ×
Emacs Stack Exchange is a question and answer site for for those using, extending or developing emacs. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Simply:

(call-interactively 'test)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.