1

I want to write a command which uses a prefix argument and reads some strings.

I know both parts individually:

(defun xtest(arg)
  (interactive "P")
  ...

reads the prefix arg.

(defun xtest(t1 t2)
  (interactive "stEins: \nstZwei: ")
  (message "%s %s %s" arg t1 t2))```

reads two strings. But when I put it together to use both:

(defun xtest(arg t1 t2)
  (interactive "PstEins: \nstZwei: ")
  ...

then I get on execution of the command the error "funcall-interactively: Wrong number of arguments".

How do I set up the function definition correctly?

1 Answer 1

2

Your string example shows that you already know how to separate multiple interactive arguments, by putting a newline between each one in the interactive spec.

So rather than:

(interactive "PstEins: \nstZwei: ")

You wanted:

(interactive "P\nstEins: \nstZwei: ")
1
  • Cool! I though the newline is just a divider for strings...
    – halloleo
    Commented Jul 4, 2019 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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