]> git.eshelyaron.com Git - emacs.git/commitdiff
New hook 'read-shell-command-minibuffer-setup-hook'
authorEshel Yaron <me@eshelyaron.com>
Tue, 24 Dec 2024 17:13:01 +0000 (18:13 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 24 Dec 2024 17:13:01 +0000 (18:13 +0100)
lisp/simple.el

index 142049ab25ff3e7464191bff98b5da67621dbe41..91d9b3ac07d046abe8aeddc9dee9ac088ca5d4dc 100644 (file)
@@ -4194,6 +4194,9 @@ after the default value."
     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',
@@ -4204,7 +4207,10 @@ to `shell-command-history'."
       (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