Is there an easy way to use thing-at-point
to initialize the contents of an interactive
string reading?
I have a function the looks something like this:
(defun foo (string)
(interactive "sString:")
;; does something with string
)
But I'd really like it if when I did M-x foo
, that it filled the minibuffer with the thing-at-point
. In this case (thing-at-point 'word)
.
Is the only way to get that to use an explicit list argument to interactive
, something like:
(defun foo (string)
(interactive (list (read-from-minibuffer
"String:" ;; prompt
(thing-at-point 'word) ;; initial value
) ) ) ; interactive
;; does something with string
)
And if I do so, do my own history list etc?