help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Having user change initial value to completing-read


From: uzibalqa
Subject: Having user change initial value to completing-read
Date: Tue, 16 Aug 2022 06:12:25 +0000

I am using the following function to preload a command affix for calling "M-x". 
I would like that the user can change
the initial value to (completing-read "Affix: " cseq nil t "typex"). What can I 
do?

(defun command-affix (affix &rest args)
"Select a command affix, which is then pre-loaded inte the minibuffer.

Like `execute-extended-command', but when called interactively,
preload a leading affix into the minibuffer."

(interactive
(list
(let ( (cseq '("galaxy" "protoc" "typex")) )
(completing-read "Affix: " cseq nil t "typex"))))

(if (interactive-p)
(progn
(setq unread-command-events (listify-key-sequence affix))
(call-interactively #'execute-extended-command))
(funcall #'execute-extended-command args)))
(global-set-key (kbd "H-x") #'command-affix)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]