Function: ibut:label-set

ibut:label-set is a byte-compiled function defined in hbut.el.

Signature

(ibut:label-set &optional LABEL START END)

Documentation

Set symbol hbut:current implicit button label attributes.

Provide optional arguments LABEL, START, and END positions. Return label.

LABEL may be:
 1. a string, then set it as the label.
 2. nil, then either leave the current button's label as is if set already
    or set it temporarily to the string, "temp".
 2. a list, then get all args, LABEL, START and END from the list.

When START and END are given, they specify the region in the buffer to flash when this implicit button is activated or queried for its attributes; this typically should be the text of the button without any delimiters.

For legacy reasons, the label here is actually the text of the implicit button matched contextually and never the optional <[name]> preceding the text.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hbut.el
(defun    ibut:label-set (&optional label start end)
  "Set symbol `hbut:current' implicit button label attributes.
Provide optional arguments LABEL, START, and END positions.
Return label.

LABEL may be:
 1. a string, then set it as the label.
 2. nil, then either leave the current button's label as is if set already
    or set it temporarily to the string, \"temp\".
 2. a list, then get all args, LABEL, START and END from the list.

When START and END are given, they specify the region in the buffer to flash
when this implicit button is activated or queried for its attributes; this
typically should be the text of the button without any delimiters.

For legacy reasons, the label here is actually the text of the
implicit button matched contextually and never the optional <[name]>
preceding the text."
  (save-match-data
    (cond ((or (stringp label) (null label))
	   (hattr:set 'hbut:current 'loc (save-excursion
					   (hbut:to-key-src 'full)))
	   (hattr:set 'hbut:current 'lbl-key (if label
                                                 (hbut:label-to-key label)
                                               (or (hattr:get 'hbut:current 'lbl-key)
                                                   "temp")))
	   (when start (hattr:set    'hbut:current 'lbl-start start))
	   (when end   (hattr:set    'hbut:current 'lbl-end   end)))
	  ((and label (listp label))
	   (hattr:set 'hbut:current 'loc (save-excursion
					   (hbut:to-key-src 'full)))
	   (hattr:set 'hbut:current 'lbl-key (hbut:label-to-key (car label)))
	   (hattr:set 'hbut:current 'lbl-start (nth 1 label))
	   (hattr:set 'hbut:current 'lbl-end (nth 2 label)))
	  (t (error "(ibut:label-set): Invalid label arg: `%s'" label)))
    label))