-1

I have a function workbench-named declared as follows, that calls another one called workbench. Have changed workbench to include a prefix argument. Thusly workbench-named is not calling workbench properly as it assumes that name is the first argument.

How can I modify the call to workbench from the function workbench-named?

    (defun workbench-named ()
      "Generate new temporary buffer by asking for buffer name."
      (interactive)
      (workbench (read-from-minibuffer " Name: ")))
(defun workbench (&optional prefix name mode)
  "Make new temporary buffer.")

Drew
  • 77,472
  • 10
  • 114
  • 243
Dilna
  • 1
  • 3
  • 11
  • (workbench nil (read-from-minibuffer " Name: "))) to provide the expected first argument. – Fran Burstall Jun 30 '22 at 13:52
  • @FranBurstall: you might want to make your comment into an answer - I believe it answers the question. – NickD Jun 30 '22 at 15:03
  • The question is quite unclear. But yes, @FranBurstall has cut to the chase (please post your answer). The question has nothing to do with any "prefix" or "prefix argument" - there isn't any such thing in any of the code shown. And the code was unparsable - doc string without ending ", etc. – Drew Jun 30 '22 at 15:50
  • Those were minor things. The focus was about how to call workbench rather than worrying about any ending ". – Dilna Jun 30 '22 at 19:40
  • Typically, you don't need two functions to do things like this. Instead, use (interactive "sName: ") to make the function ask for a name when called as a command, but use the argument passed to it when called as a function. – Lindydancer Jun 30 '22 at 20:14

1 Answers1

1

If you want to supply just one optional argument, you need to also provide values for preceding arguments in the function's signature. Thus, in this case,

(workbench nil (read-from-minibuffer " Name: ")))

does the job.

Fran Burstall
  • 3,855
  • 11
  • 18