Function: actypes::link-to-file

actypes::link-to-file is an interactive and byte-compiled function defined in hactypes.el.

Signature

(actypes::link-to-file PATH &optional REFERENT-START)

Documentation

Display a file given by PATH scrolled to optional REFERENT-START.

If REFERENT-START position is given, display the buffer with REFERENT-START at the top of the window or as close as possible.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20261030.2317/hactypes.el
(defact link-to-file (path &optional referent-start)
  "Display a file given by PATH scrolled to optional REFERENT-START.
If REFERENT-START position is given, display the buffer with REFERENT-START
at the top of the window or as close as possible."
  (interactive (hactypes:link-to-file-interactively))
  (if (stringp path)
      (let ((src-buf (current-buffer))
            (src-start (point))
            referent-buf)
	;; Remove any double quotes and whitespace at the start and end of
	;; the path that use within a key series may have introduced.
	(setq path (hpath:trim path))
	(when (and (setq referent-buf (hpath:find path))
                   (integer-or-marker-p referent-start)
                   (eq (current-buffer) referent-buf))
	  (goto-char (min (point-max) referent-start))
	  (recenter 0))
        (when (string-match-p "\\.kotl\\([:#]\\|\\'\\)" path)
          ;; If is a koutline reference with an =idstamp, then update
          ;; reference relative label if need be; this may be in a different
          ;; buffer than the current one.
          (save-window-excursion
	    (klink:update-label path src-start src-buf))))
    (hypb:error "(link-to-file): Invalid file name: \"%s\"" path)))