Function: ibtypes::pathname-line-and-column

ibtypes::pathname-line-and-column is a byte-compiled function defined in hibtypes.el.

Signature

(ibtypes::pathname-line-and-column)

Documentation

Display path at position given by a pathname:line-num[:column-num] pattern.

Also works for remote pathnames. May also contain hash-style link references with the following format:
"<path>[#<link-anchor>]:[L]<line-num>[:[C]<column-num>]}".

See hpath:at-p function documentation for possible delimiters. See hpath:suffixes variable documentation for suffixes that are added to or removed from pathname when searching for a valid match. See hpath:find function documentation for special file display options.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hibtypes.el
;;; ========================================================================
;;; Displays files at specific lines and optional column number
;;; locations.
;;; ========================================================================

(defib pathname-line-and-column ()
  "Display path at position given by a pathname:line-num[:column-num] pattern.
Also works for remote pathnames.
May also contain hash-style link references with the following format:
\"<path>[#<link-anchor>]:[L]<line-num>[:[C]<column-num>]}\".

See `hpath:at-p' function documentation for possible delimiters.
See `hpath:suffixes' variable documentation for suffixes that are added to or
removed from pathname when searching for a valid match.
See `hpath:find' function documentation for special file display options."
  (let* ((path-start-and-end (hpath:delimited-possible-path nil t))
	 (path-line-and-col (nth 0 path-start-and-end))
	 (start (nth 1 path-start-and-end)))
    (when (and (stringp path-line-and-col)
               (string-match hpath:section-line-and-column-regexp path-line-and-col))
      (let* ((line-num (string-to-number (match-string-no-properties 3 path-line-and-col)))
             (col-num (when (match-end 4)
			(string-to-number (match-string-no-properties 5 path-line-and-col))))
	     (label (match-string-no-properties 1 path-line-and-col))
	     ;; Next variable should come last as it can overwrite the match-data
	     file)
        (when (setq file (or (hpath:is-p (hpath:expand label))
                             (hywiki-get-existing-page-file label)))
          (ibut:label-set label start (+ start (length label)))
          (if col-num
              (hact 'link-to-file-line-and-column file line-num col-num)
            (hact 'link-to-file-line file line-num)))))))