13

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?

Drew
  • 75,699
  • 9
  • 109
  • 225
Pradhan
  • 2,330
  • 14
  • 28

1 Answers1

14

Simply:

(call-interactively 'test)
abo-abo
  • 13,943
  • 1
  • 29
  • 43