Function: actypes::link-to-kcell

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

Signature

(actypes::link-to-kcell FILE CELL-REF)

Documentation

Display FILE with kcell given by CELL-REF at window top.

See documentation for kcell:ref-to-id for valid cell-ref formats.

If FILE is nil, use any source location or the current buffer. If CELL-REF is nil, show the first cell in the view.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260815.958/hactypes.el
    ;; !! Left over code from an earlier version of `link-to-ibut' in case
    ;; is ever needed for reference.  rsw - 2026-06-18
    ;;
    ;; (if key-src
    ;;     (unless (and (get-buffer key-src)
    ;;               (not (hypb:buffer-file-name (get-buffer key-src))))
    ;;       (setq normalized-file (hpath:normalize key-src)))
    ;;   (setq normalized-file (hpath:normalize (hypb:buffer-file-name))))
    ;; (when key-src
    ;;   (set-buffer (or (get-buffer key-src) (get-file-buffer normalized-file))))
    ;; (widen)
    ;; (when (or (not normalized-file) (hmail:editor-p) (hmail:reader-p))
    ;;   (hmail:msg-narrow))
    ;; (when (integerp point)
    ;;   (goto-char (min point (point-max))))
    ;; (setq but (ibut:to-text name-key))
    ;; (cond (but
    ;;        (setq actype (actype:def-symbol (hattr:get but 'actype)))
    ;;        (if (eq actype 'link-to-ibut)
    ;;            (hypb:error "(link-to-ibut): Failed to find implicit button named `%s' in `%s'"
    ;;                     (ibut:key-to-label name-key)
    ;;                     (or key-src (buffer-name)))
    ;;          (apply #'actype:act (hattr:get but 'actype)
    ;;                 (hattr:get but 'args))))
    ;;       (name-key
    ;;        (hypb:error "(link-to-ibut): No implicit button named `%s' found in `%s'"
    ;;                 (ibut:key-to-label name-key)
    ;;                 (or key-src (buffer-name))))
    ;;       (t
    ;;        (hypb:error "(link-to-ibut): Link reference is null/empty")))))

(defact link-to-kcell (file cell-ref)
  "Display FILE with kcell given by CELL-REF at window top.
See documentation for `kcell:ref-to-id' for valid cell-ref formats.

If FILE is nil, use any source location or the current buffer.
If CELL-REF is nil, show the first cell in the view."
  (interactive (hargs:iform-read '(interactive "fKotl file to link to: \n+KKcell to link to: ")))
  (require 'kfile)
  ;; May already be in an 'hpath:find' call where the referent buffer
  ;; has already been made current.  In that case, skip a second
  ;; display of the buffer.
  (unless (and (hyperb:stack-frame '(hpath:find))
	       ;; Perform a loose test that the current buffer
	       ;; file name matches the path file name since exact
	       ;; matching of path is likely to be wrong in
	       ;; certain cases, e.g. with mount point or os path
	       ;; alterations.
	       (hypb:buffer-file-name)
	       file
	       (or (null file)
		   (string-empty-p file)
		   (equal (file-name-nondirectory file)
			  (file-name-nondirectory (hypb:buffer-file-name)))))
    (when (or (null file) (string-empty-p file))
      (setq file (hbut:get-key-src t)))
    (if (stringp file)
	(hpath:find file)
      ;; file can be a buffer from get-key-src call
      (hpath:display-buffer (or file (current-buffer)))))
  (kotl-mode:goto-cell-ref cell-ref))