Function: hlink:parse-label-and-loc

hlink:parse-label-and-loc is a byte-compiled function defined in hibtypes.el.

Signature

(hlink:parse-label-and-loc LABEL-AND-LOC)

Documentation

Parse colon-separated string LABEL-AND-LOC into a list of label and src loc.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hibtypes.el
(defun hlink:parse-label-and-loc (label-and-loc)
  "Parse colon-separated string LABEL-AND-LOC into a list of label and src loc."
  (let (i
        label
        file)
    (when (and (stringp label-and-loc) (setq i (seq-position label-and-loc ?: '=)))
      (when (zerop i)
        (error "(hlink:parse-label-and-loc): Missing label: '%s'" label-and-loc))
      (setq label (hpath:trim (substring label-and-loc 0 i))
            file (hpath:trim (substring label-and-loc (1+ i))))
      (when (string-empty-p label) (setq label nil))
      (when (string-empty-p file) (setq file nil)))
    (unless (or label (string-empty-p label-and-loc))
      (setq label label-and-loc))
    (delq nil (list label file))))