(add-hook 'minibuffer-setup-hook #'minibuffer-update-prompt-indicators 95)
(defun minibuffer-action (&optional alt)
- "Return the minibuffer action function for the current minibuffer."
+ "Return the minibuffer action function for the current minibuffer.
+
+If optional argument ALT is non-nil and there is an alternative
+minibuffer action, return the alternative action instead."
(or (and alt minibuffer-alternative-action)
minibuffer-action
(when-let* ((cmd current-minibuffer-command)
(when (symbolp cmd) (minibuffer--get-action cmd)))))
(defun minibuffer-apply (input &optional prefix alt)
- "Apply action to current minibuffer INPUT prefixed by PREFIX."
+ "Apply minibuffer action to current INPUT.
+
+Optional argument PREFIX, if non-nil, is a string to prepend to INPUT
+before passing it to the action function. If optional argument ALT is
+non-nil and there is an alternative minibuffer action, apply the
+alternative action instead.
+
+Interactively, INPUT is the current minibuffer input sans the completion
+base, PREFIX is the completion base, and ALT is nil."
(interactive (let* ((input-prefix (minibuffer-current-input))
(input (car input-prefix))
(prefix (cdr input-prefix)))
'completions-used-input)))))))
(defun minibuffer-apply-alt (input &optional prefix)
- "Apply action to current minibuffer INPUT prefixed by PREFIX."
+ "Apply alternative minibuffer action to current INPUT.
+
+If there is no alternative action, apply the regular (non-alternative)
+action instead.
+
+Optional argument PREFIX, if non-nil, is a string to prepend to INPUT
+before passing it to the action function.
+
+Interactively, INPUT is the current minibuffer input sans the completion
+base, and PREFIX is the completion base."
(interactive (let* ((input-prefix (minibuffer-current-input))
(input (car input-prefix))
(prefix (cdr input-prefix)))
(minibuffer-apply input prefix t))
(defun minibuffer-query-apply (&optional alt)
- "Suggest applying the minibuffer action to each completion candidate in turn."
+ "Suggest applying the minibuffer action to each completion candidate in turn.
+
+If optional argument ALT is non-nil and there is an alternative
+minibuffer action, apply the alternative action instead."
(interactive "P" minibuffer-mode)
(with-minibuffer-completions-window
(let (prev all done)
nil t nil nil default))))
(defun minibuffer-predicate-description-to-function (desc)
+ "Return predicate function the DESC describes, or nil."
(catch 'stop
(advice-function-mapc
(lambda (a p)
nil))
(defun minibuffer-latest-predicate-description ()
- "Return the completion predicate you added most recently."
+ "Return the completion predicate you added most recently, or nil."
(catch 'stop
(advice-function-mapc
(lambda (_ p)