map)
"Keymap used for completing shell commands in minibuffer.")
+(defvar read-shell-command-minibuffer-setup-hook nil
+ "Hook run by `read-shell-command' when entering the minibuffer.")
+
(defun read-shell-command (prompt &optional initial-contents hist &rest args)
"Read a shell command from the minibuffer.
The arguments are the same as the ones of `read-from-minibuffer',
(lambda ()
(shell-completion-vars)
(setq-local minibuffer-default-add-function
- #'minibuffer-default-add-shell-commands))
+ #'minibuffer-default-add-shell-commands)
+ (add-hook 'minibuffer-exit-hook
+ #'minibuffer-kill-completions-buffer nil t)
+ (run-hooks 'read-shell-command-minibuffer-setup-hook))
(apply #'read-from-minibuffer prompt initial-contents
minibuffer-local-shell-command-map
nil