Function: actypes::link-to-ibut
actypes::link-to-ibut is an interactive and byte-compiled function
defined in hactypes.el.
Signature
(actypes::link-to-ibut NAME-KEY &optional BUT-SRC POINT)
Documentation
Activate implicit button given by NAME-KEY, optional BUT-SRC and POINT.
NAME-KEY must be a normalized key for an ibut <[name]>. BUT-SRC defaults to the current buffer's file or if there is no attached file, then to its buffer name. POINT defaults to the current point.
When the button with this action type is created, point must be on the implicit button to which to link.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hactypes.el
(defact link-to-ibut (name-key &optional but-src point)
"Activate implicit button given by NAME-KEY, optional BUT-SRC and POINT.
NAME-KEY must be a normalized key for an ibut <[name]>.
BUT-SRC defaults to the current buffer's file or if there is no
attached file, then to its buffer name. POINT defaults to the
current point.
When the button with this action type is created, point must be
on the implicit button to which to link."
(interactive
(let ((ibut-name-key (ibut:at-p t)))
(cond (ibut-name-key
(list ibut-name-key (or (hypb:buffer-file-name) (buffer-name)) (point)))
;; !! TODO: If default is null below and are creating, rather than editing
;; the link, it would be better to throw an error than create
;; an invalid link, but it is difficult to tell which operation
;; is in progress, so ignore this for now. -- RSW, 01-25-2020
;; When not on an ibut and editing the link, use existing arguments
((and (bound-and-true-p hargs:defaults) (listp hargs:defaults) hargs:defaults)
hargs:defaults)
(t
(hypb:error "(link-to-ibut): Point must be on an implicit button to create a link-to-ibut")))))
(unless name-key
(hypb:error "(link-to-ibut): Point must be on an implicit button to create a link-to-ibut"))
(let (but
normalized-file)
(if but-src
(unless (and (get-buffer but-src)
(not (hypb:buffer-file-name (get-buffer but-src))))
(setq normalized-file (hpath:normalize but-src)))
(setq normalized-file (hpath:normalize (hypb:buffer-file-name))))
(when but-src
(set-buffer (or (get-buffer but-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 but (ibut:at-p))
(hbut:act but))
(name-key
(hypb:error "(link-to-ibut): No implicit button named `%s' found in `%s'"
(ibut:key-to-label name-key)
(or but-src (buffer-name))))
(t
(hypb:error "(link-to-ibut): Link reference is null/empty")))))