Function: hui:hbut-operate
hui:hbut-operate is a byte-compiled function defined in hui.el.
Signature
(hui:hbut-operate OPERATION OPERATION-STR &optional BUT)
Documentation
Execute OPERATION func described by OPERATION-STR action on a Hyperbole button.
With optional BUT use that. If none then either the button at point is used or if none, then one is prompted for with completion of all labeled buttons within the current buffer.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:hbut-operate (operation operation-str &optional but)
"Execute OPERATION func described by OPERATION-STR action on a Hyperbole button.
With optional BUT use that. If none then either the button at
point is used or if none, then one is prompted for with
completion of all labeled buttons within the current buffer."
(unless (or but (setq but (hbut:at-p)))
(let (lst)
(cond ((setq lst (nconc (ebut:alist) (ibut:alist)))
(setq but (hbut:get (hbut:label-to-key
(hargs:read-match operation-str
lst nil t
(hbut:label-p 'as-label) 'hbut)))))
(t (hypb:error "(hbut-operate): No labeled buttons in buffer")))))
(cond ((and (called-interactively-p 'interactive) (null but))
(hypb:error "(hbut-operate): No current button upon which to operate"))
((progn (unless but (setq but 'hbut:current))
(hbut:is-p but))
;; Temporarily move point to start of the button text for flashing and activation.
;; Only if the button action does not move point, restore point to it previous value.
(let ((opoint (point-marker))
(text-start (hattr:get but 'lbl-start)))
(if text-start
(goto-char text-start)
(ibut:to-text (hattr:get but 'lbl-key)))
(setq text-start (point-marker))
(hui:but-flash)
(unwind-protect
(apply hrule:action operation `(',but))
;; Restore point as it was prior to `text-start' move
;; if the action switched buffers or did not move point
;; within the current buffer.
(when (or (equal text-start (point-marker))
(not (eq (current-buffer) (marker-buffer opoint))))
(with-current-buffer (marker-buffer opoint)
(let ((owind (get-buffer-window nil t)))
(if owind
(set-window-point owind opoint)
(goto-char opoint)))))
(set-marker opoint nil)
(set-marker text-start nil))))
((and but (symbolp but))
(hypb:error "(hbut-operate): Symbol, %s, has invalid Hyperbole button attributes:\n %S" but (hattr:list but)))
(t
(hypb:error "(hbut-operate): Invalid Hyperbole button: %s" but))))