Function: hpath:choose-from-path-variable

hpath:choose-from-path-variable is a byte-compiled function defined in hpath.el.

Signature

(hpath:choose-from-path-variable PATH-VAR &optional ACTION-STR)

Documentation

Interactively choose and return a path from the set in PATH-VAR.

PATH-VAR is a colon or semicolon-delimited set. Optional ACTION-STR is used at the start of a prompt to choose the path.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:choose-from-path-variable (path-var &optional action-str)
  "Interactively choose and return a path from the set in PATH-VAR.
PATH-VAR is a colon or semicolon-delimited set.  Optional
ACTION-STR is used at the start of a prompt to choose the path."
  (let (path-value
	paths)
    (when (setq path-value (hpath:is-path-variable-p path-var)
		paths (and path-value
			   (split-string path-value (if (string-match ";" path-value) ";" ":") nil "\\s-")))
      (setq paths (sort (mapcar (lambda (path) (if (string-empty-p path) "." path)) paths) #'string-lessp))
      (unless (memq t (mapcar (lambda (mode) (when (fboundp mode) (symbol-value mode))) hpath:auto-completing-read-modes))
	(kbd-key:key-series-to-events "?"))
      (completing-read (format "%s path from ${%s}: "
			       (if (stringp action-str) action-str "Choose")
			       path-var)
		       paths nil t))))