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 KEY-SRC POINT)

Documentation

Activate implicit button given by NAME-KEY, optional KEY-SRC and _POINT.

NAME-KEY must be a normalized key for an ibut <[name]>. KEY-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-20260815.958/hactypes.el
(defact link-to-ibut (name-key &optional key-src _point)
  "Activate implicit button given by NAME-KEY, optional KEY-SRC and _POINT.
NAME-KEY must be a normalized key for an ibut <[name]>.
KEY-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* ((key-src-buf-flag (or (bufferp key-src)
                               (and (stringp key-src)
                                    (setq key-src (or (get-buffer key-src)
                                                      key-src))
                                    (bufferp key-src))))
         (but (if key-src-buf-flag
                  (ibut:get name-key key-src)
                (ibut:get name-key nil key-src)))
         actype
	 ;; normalized-file
         )
    (if but
        (progn (setq actype (actype:def-symbol (hattr:get but 'actype)))
               (if (eq actype 'link-to-ibut)
                   (hypb:error "(link-to-ibut): No button `%s' in `%s'"
                               (ibut:key-to-label name-key)
                               (or key-src (buffer-name)))
                 (ibut:act but)))
      (unless key-src-buf-flag
        (setq key-src (if key-src
                          (hpath:normalize key-src)
                        (hbut:get-key-src t))))
      (hypb:error "(link-to-ibut): No button `%s' in `%s'"
                  (ibut:key-to-label name-key)
                  key-src))))