Inserting Text into an Active Minibuffer

2019-07-22 20:20发布

I'm trying to insert text into the mini buffer after running an external command. E.G

(call-interactively 'eval-expression)
(insert "blah")

The problem of course is that eval-expression doesn't return before the user has entered input. My end goal is to add some default editable text into the mini buffer prompt of an arbitrary command (i.e a 'default string' or template). How can I go about accomplishing this?

1条回答
疯言疯语
2楼-- · 2019-07-22 20:56

Use minibuffer-setup-hook:

(defun foo () (insert "ABCDE"))

(add-hook 'minibuffer-setup-hook 'foo)
查看更多
登录 后发表回答