The following function constructed by @dalanicolai has been adapted in a way that allows a user to automatically select a function affix name galaxy
, protoc
or typex
, which is then bound to H-x.
What possibilities are there for improvement, enhancement, or simplification?
(defun command-affix (affix &rest args)
"Read a command name to call, favoring commands that begin with `*'.
Like `execute-extended-command', but when called interactively,
preload a leading `*' 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)