Am trying to use read-string
to read a string from the user. With that name I want to create a new buffer.
Have seen that read-string
is sometimes called from within an interactive
expression, but at other times, read-string
is called outside on interactive
expression. How can I understand when to use one versus the other?
(defun workspace (name)
"Make a new buffer with unique name."
(interactive
(read-string "Name: " initial nil nil))
(let ( ($buf (generate-new-buffer name)) )
(switch-to-buffer $buf)
)
Code Characters
forinteractive
. But seeing other's code, I also see calls that use,read-string
,completing read
. But not much advice on when to choose what. You have any advice on this? – Dilna Jun 27 '22 at 12:25B
uses the name of a recently used buffer. I want to avoid that when making the new buffer. Can I get emacs to generate a unique name, but also let the user change it? – Dilna Jun 27 '22 at 12:37read-string
(interactively or not), please retitle and reword your question to better fit the answer. Thx. – Drew Jun 27 '22 at 18:40