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
  • 77,472
  • 10
  • 114
  • 243
Pradhan
  • 2,370
  • 15
  • 28

1 Answers1

15

Simply:

(call-interactively 'test)
abo-abo
  • 14,113
  • 1
  • 30
  • 43