Function: hargs:select-p
hargs:select-p is a byte-compiled function defined in hargs.el.
Signature
(hargs:select-p &optional VALUE ASSIST-BOOL)
Documentation
Return optional VALUE or value in the minibuffer if any, else nil.
If VALUE is a list, it must be of the form:
(<str-to-compare-against-minibuffer-contents> <is-exact-completion-flag>).
The first argument is then set to VALUE. If
<is-exact-completion-flag> is non-null, then Hyperbole will not try to
show completions for VALUE when standard completion is used.
If VALUE is the same as the contents of the minibuffer, it is used as the desired minibuffer argument and the minibuffer is exited; otherwise, the minibuffer is erased and VALUE is inserted there. Optional ASSIST-BOOL non-nil triggers display of Hyperbole menu item help when appropriate.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hargs.el
(defun hargs:select-p (&optional value assist-bool)
"Return optional VALUE or value in the minibuffer if any, else nil.
If VALUE is a list, it must be of the form:
\(<str-to-compare-against-minibuffer-contents> <is-exact-completion-flag>).
The first argument is then set to VALUE. If
<is-exact-completion-flag> is non-null, then Hyperbole will not try to
show completions for VALUE when standard completion is used.
If VALUE is the same as the contents of the minibuffer, it is
used as the desired minibuffer argument and the minibuffer is
exited; otherwise, the minibuffer is erased and VALUE is inserted
there. Optional ASSIST-BOOL non-nil triggers display of
Hyperbole menu item help when appropriate."
(when (and (> (minibuffer-depth) 0) (or value (setq value (hargs:at-p))))
(let ((owind (selected-window)) (back-to)
;; This command requires recursive minibuffers.
(enable-recursive-minibuffers t)
mini)
(when (stringp value)
(setq value (list value nil)))
(unwind-protect
(cl-destructuring-bind (str-value exact-completion-flag) value
(setq str-value (and str-value (format "%s" str-value)))
(select-window (minibuffer-window))
(set-buffer (window-buffer (minibuffer-window)))
(setq mini (minibuffer-contents-no-properties))
(cond
;;
;; Selecting a Hyperbole minibuffer menu item
((eq hargs:reading-type 'hmenu)
(when assist-bool
(setq hargs:reading-type 'hmenu-help))
(hui:menu-enter str-value))
;;
;; Exit minibuffer and use its existing value as the desired parameter
;; if value matches a completion and the minibuffer contents.
;;
;; with vertico-mode
((and (bound-and-true-p vertico-mode)
;; Ensure vertico is prompting for an argument
(vertico--command-p nil (current-buffer))
(string-equal str-value mini)
(vertico--match-p str-value))
(goto-char (point-max))
(vertico-exit))
;; with ivy-mode
((and (bound-and-true-p ivy-mode)
(string-equal str-value mini)
(hargs:match-p str-value))
(goto-char (point-max))
(if assist-bool
(ivy-dispatching-done)
(ivy-done)))
;; with standard minibuffer completion
((and (string-equal str-value mini)
(hargs:match-p str-value))
(goto-char (point-max))
(exit-minibuffer))
;;
;; Value is different than minibuffer contents; clear
;; minibuffer and insert value.
(t
(delete-minibuffer-contents)
(goto-char (point-max))
(cond
;; with vertico-mode
((and (bound-and-true-p vertico-mode)
;; Ensure vertico is prompting for an argument
(vertico--command-p nil (current-buffer)))
(if str-value
(insert str-value)
(vertico-insert))
(vertico--update t))
;; with ivy-mode
((bound-and-true-p ivy-mode)
(insert str-value)
(if assist-bool
(ivy-dispatching-done)
(ivy-done)))
;; with standard minibuffer completion
(t
(insert str-value)
(unless exact-completion-flag
(minibuffer-completion-help))
(setq back-to t)))
value)))
(when (and back-to (window-live-p owind))
(select-window owind))))))