Function: ebut:to
ebut:to is a byte-compiled function defined in hbut.el.
Signature
(ebut:to LBL-KEY)
Documentation
Find the nearest explicit button with LBL-KEY (a label or label key).
Search within the visible portion of the current buffer. Leave point inside the button label. Return the symbol for the button, else nil.
When LBL-KEY is nil, return the ebutton at point or nil if none.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbut.el
(defun ebut:to (lbl-key)
"Find the nearest explicit button with LBL-KEY (a label or label key).
Search within the visible portion of the current buffer. Leave
point inside the button label. Return the symbol for the button,
else nil.
When LBL-KEY is nil, return the ebutton at point or nil if none."
(if lbl-key
(hbut:funcall (lambda (lbl-key _buffer _key-src)
;; Handle a label given rather than a label key
(if (string-match-p "\\s-" lbl-key)
(setq lbl-key (ebut:label-to-key lbl-key)))
(let ((regexp (hbut:label-regexp lbl-key t))
pos
found)
(save-excursion
;; Since point might be in the middle of the matching button,
;; move to the start of line to ensure don't miss it when
;; searching forward.
(forward-line 0)
;; re-search forward
(while (and (not found) (re-search-forward regexp nil t))
(setq pos (match-beginning 0)
found (equal (ebut:label-p nil nil nil nil t) lbl-key)))
;; re-search backward
(while (and (not found) (re-search-backward regexp nil t))
(setq pos (match-beginning 0)
found (equal (ebut:label-p nil nil nil nil t) lbl-key))))
(when found
(goto-char pos)
(ebut:at-p))))
lbl-key
(current-buffer))
(ebut:at-p)))