Function: button-put

button-put is a byte-compiled function defined in button.el.gz.

Signature

(button-put BUTTON PROP VAL)

Documentation

Set BUTTON's PROP property to VAL.

This function only works when BUTTON is in the current buffer.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/button.el.gz
(defun button-put (button prop val)
  "Set BUTTON's PROP property to VAL.

This function only works when BUTTON is in the current buffer."
  ;; Treat some properties specially.
  (cond ((memq prop '(type :type))
         ;; We translate a `type' property to a `category' property,
         ;; since that's what's actually used by overlay and
         ;; text-property buttons for inheriting properties.
	 (setq prop 'category)
	 (setq val (button-category-symbol val)))
	((eq prop 'category)
	 ;; Disallow updating the `category' property directly.
	 (error "Button `category' property may not be set directly")))
  ;; Add the property.
  (cond ((overlayp button)
	 (overlay-put button prop val))
	((button--area-button-p button)
	 (setq button (button--area-button-string button))
	 (put-text-property 0 (length button) prop val button))
	(t ; Must be a text-property button.
	 (put-text-property
	  (or (previous-single-property-change (1+ button) 'button)
	      (point-min))
	  (or (next-single-property-change button 'button)
	      (point-max))
	  prop val))))