Function: hsys-consult-get-exit-value

hsys-consult-get-exit-value is an autoloaded and byte-compiled function defined in hsys-consult.el.

Signature

(hsys-consult-get-exit-value EXIT-VALUE CONSULT-FUNCTION &rest ARGS)

Documentation

With minibuffer EXIT-VALUE, call CONSULT-FUNCTION with rest of ARGS.

If EXIT-VALUE is non-nil, i.e. an sexpression or function of no arguments, store and return its result value into hsys-consult-exit-value, Otherwise, return the selection from CONSULT-FUNCTION.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hsys-consult.el
;;;###autoload
(defun hsys-consult-get-exit-value (exit-value consult-function &rest args)
  "With minibuffer EXIT-VALUE, call CONSULT-FUNCTION with rest of ARGS.
If EXIT-VALUE is non-nil, i.e. an sexpression or function of no
arguments, store and return its result value into `hsys-consult-exit-value',
Otherwise, return the selection from CONSULT-FUNCTION."
  (unless hsys-consult-flag
    (error "`%s' command requires `hsys-consult-flag' set to t" this-command))
  (unless (hypb:function-p consult-function)
    (user-error "(hsys-consult-get-exit-value): First arg must be a function, not `%s'"
		consult-function))

  (save-excursion
    (save-window-excursion
      (if exit-value
	  (let ((exit-hook `(lambda ()
			      (setq hsys-consult-exit-value
				    (if (functionp ',exit-value)
				       (funcall ',exit-value)
				      (eval ',exit-value))))))
	    (unwind-protect
		(progn (push exit-hook minibuffer-exit-hook)
		       (apply consult-function args)
		       hsys-consult-exit-value)
	      (setf minibuffer-exit-hook (delq exit-hook minibuffer-exit-hook))))
	(apply consult-function args)))))