Function: hib-link-to-file-line

hib-link-to-file-line is a byte-compiled function defined in hibtypes.el.

Signature

(hib-link-to-file-line FILE LINE-NUM)

Documentation

Expand FILE and jump to its LINE-NUM in Hyperbole specified window.

The variable hpath:display-where determines where to display the file. LINE-NUM may be an integer or string.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hibtypes.el
;;; ========================================================================
;;; Jumps to source line associated with ipython, ripgrep, grep or
;;; compilation errors or HyRolo stuck position error messages.
;;; ========================================================================

(defun hib-link-to-file-line (file line-num)
  "Expand FILE and jump to its LINE-NUM in Hyperbole specified window.
The variable `hpath:display-where' determines where to display the file.
LINE-NUM may be an integer or string."
  ;; RSW 12-05-2021 - Add hpath:expand in next line to resolve any variables
  ;; in the path before checking if absolute.
  ;; RSW 03-22-2026 - Save expanded-file and use if absolute in order to
  ;; prefer files found in current directory over those in a `load-path' dir.
  (let ((expanded-file (hpath:expand file))
        source-loc)
    (unless (and (stringp expanded-file) (file-name-absolute-p expanded-file))
      (setq expanded-file nil))
    (setq source-loc (unless expanded-file (hbut:to-key-src t)))
    (cond (expanded-file
           (setq file expanded-file))
          ((stringp source-loc)
           (setq file (expand-file-name file (file-name-directory source-loc))))
          (t (setq file (or (hpath:prepend-shell-directory file)
                            ;; find-library-name will strip file
                            ;; suffixes, so use it only when the file
                            ;; either doesn't have a suffix or has a
                            ;; library suffix.
                            (let ((ext (file-name-extension file)))
                              (when (or (null ext)
                                        (member (concat "." ext) (get-load-suffixes)))
                                (ignore-errors (find-library-name file))))
                            (hpath:is-p (expand-file-name file))
                            (hywiki-get-existing-page-file file)))))
    (when (file-exists-p (hpath:normalize file))
      (actypes::link-to-file-line file line-num))))