Mercurial > emacs
comparison lisp/button.el @ 39917:eb6a85173992
Doc fixes.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 14 Oct 2001 15:16:57 +0000 |
parents | 5827976776b9 |
children | 57f029917c77 |
comparison
equal
deleted
inserted
replaced
39916:5827976776b9 | 39917:eb6a85173992 |
---|---|
111 (defun define-button-type (name &rest properties) | 111 (defun define-button-type (name &rest properties) |
112 "Define a `button type' called NAME. | 112 "Define a `button type' called NAME. |
113 The remaining arguments form a sequence of PROPERTY VALUE pairs, | 113 The remaining arguments form a sequence of PROPERTY VALUE pairs, |
114 specifying properties to use as defaults for buttons with this type | 114 specifying properties to use as defaults for buttons with this type |
115 \(a button's type may be set by giving it a `type' property when | 115 \(a button's type may be set by giving it a `type' property when |
116 creating the button). | 116 creating the button, using the :type keyword argument). |
117 | 117 |
118 The property `supertype' may be used to specify a button-type from which | 118 In addition, the keyword argument :supertype may be used to specify a |
119 NAME inherits its default property values \(however, the inheritance | 119 button-type from which NAME inherits its default property values |
120 happens only when NAME is defined; subsequent changes to a supertype are | 120 \(however, the inheritance happens only when NAME is defined; subsequent |
121 not reflected in its subtypes)." | 121 changes to a supertype are not reflected in its subtypes)." |
122 (let* ((catsym (make-symbol (concat (symbol-name name) "-button"))) | 122 (let* ((catsym (make-symbol (concat (symbol-name name) "-button"))) |
123 (supertype | 123 (supertype |
124 (or (plist-get properties 'supertype) | 124 (or (plist-get properties 'supertype) |
125 (plist-get properties :supertype))) | 125 (plist-get properties :supertype))) |
126 (super-catsym | 126 (super-catsym |
218 (defun button-label (button) | 218 (defun button-label (button) |
219 "Return BUTTON's text label." | 219 "Return BUTTON's text label." |
220 (buffer-substring-no-properties (button-start button) (button-end button))) | 220 (buffer-substring-no-properties (button-start button) (button-end button))) |
221 | 221 |
222 (defsubst button-type (button) | 222 (defsubst button-type (button) |
223 "Return BUTTON's button-type." | |
223 (button-get button 'type)) | 224 (button-get button 'type)) |
224 | 225 |
225 (defun button-has-type-p (button type) | 226 (defun button-has-type-p (button type) |
226 "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes." | 227 "Return t if BUTTON has button-type TYPE, or one of TYPE's subtypes." |
227 (button-type-subtype-p (button-get button 'type) type)) | 228 (button-type-subtype-p (button-get button 'type) type)) |
231 | 232 |
232 ;;;###autoload | 233 ;;;###autoload |
233 (defun make-button (beg end &rest properties) | 234 (defun make-button (beg end &rest properties) |
234 "Make a button from BEG to END in the current buffer. | 235 "Make a button from BEG to END in the current buffer. |
235 The remaining arguments form a sequence of PROPERTY VALUE pairs, | 236 The remaining arguments form a sequence of PROPERTY VALUE pairs, |
236 specifying properties to add to the button. In particular, the `type' | 237 specifying properties to add to the button. |
237 property may be used to specify a button-type from which to inherit | 238 In addition, the keyword argument :type may be used to specify a |
238 other properties; see `define-button-type'. | 239 button-type from which to inherit other properties; see |
240 `define-button-type'. | |
239 | 241 |
240 Also see `make-text-button', `insert-button'." | 242 Also see `make-text-button', `insert-button'." |
241 (let ((overlay (make-overlay beg end nil t nil))) | 243 (let ((overlay (make-overlay beg end nil t nil))) |
242 (while properties | 244 (while properties |
243 (button-put overlay (pop properties) (pop properties))) | 245 (button-put overlay (pop properties) (pop properties))) |
252 | 254 |
253 ;;;###autoload | 255 ;;;###autoload |
254 (defun insert-button (label &rest properties) | 256 (defun insert-button (label &rest properties) |
255 "Insert a button with the label LABEL. | 257 "Insert a button with the label LABEL. |
256 The remaining arguments form a sequence of PROPERTY VALUE pairs, | 258 The remaining arguments form a sequence of PROPERTY VALUE pairs, |
257 specifying properties to add to the button. In particular, the `type' | 259 specifying properties to add to the button. |
258 property may be used to specify a button-type from which to inherit | 260 In addition, the keyword argument :type may be used to specify a |
259 other properties; see `define-button-type'. | 261 button-type from which to inherit other properties; see |
262 `define-button-type'. | |
260 | 263 |
261 Also see `insert-text-button', `make-button'." | 264 Also see `insert-text-button', `make-button'." |
262 (apply #'make-button | 265 (apply #'make-button |
263 (prog1 (point) (insert label)) | 266 (prog1 (point) (insert label)) |
264 (point) | 267 (point) |
269 | 272 |
270 ;;;###autoload | 273 ;;;###autoload |
271 (defun make-text-button (beg end &rest properties) | 274 (defun make-text-button (beg end &rest properties) |
272 "Make a button from BEG to END in the current buffer. | 275 "Make a button from BEG to END in the current buffer. |
273 The remaining arguments form a sequence of PROPERTY VALUE pairs, | 276 The remaining arguments form a sequence of PROPERTY VALUE pairs, |
274 specifying properties to add to the button. In particular, the `type' | 277 specifying properties to add to the button. |
275 property may be used to specify a button-type from which to inherit | 278 In addition, the keyword argument :type may be used to specify a |
276 other properties; see `define-button-type'. | 279 button-type from which to inherit other properties; see |
280 `define-button-type'. | |
277 | 281 |
278 This function is like `make-button', except that the button is actually | 282 This function is like `make-button', except that the button is actually |
279 part of the text instead of being a property of the buffer. Creating | 283 part of the text instead of being a property of the buffer. Creating |
280 large numbers of buttons can also be somewhat faster using | 284 large numbers of buttons can also be somewhat faster using |
281 `make-text-button'. | 285 `make-text-button'. |
304 | 308 |
305 ;;;###autoload | 309 ;;;###autoload |
306 (defun insert-text-button (label &rest properties) | 310 (defun insert-text-button (label &rest properties) |
307 "Insert a button with the label LABEL. | 311 "Insert a button with the label LABEL. |
308 The remaining arguments form a sequence of PROPERTY VALUE pairs, | 312 The remaining arguments form a sequence of PROPERTY VALUE pairs, |
309 specifying properties to add to the button. In particular, the `type' | 313 specifying properties to add to the button. |
310 property may be used to specify a button-type from which to inherit | 314 In addition, the keyword argument :type may be used to specify a |
311 other properties; see `define-button-type'. | 315 button-type from which to inherit other properties; see |
316 `define-button-type'. | |
312 | 317 |
313 This function is like `insert-button', except that the button is | 318 This function is like `insert-button', except that the button is |
314 actually part of the text instead of being a property of the buffer. | 319 actually part of the text instead of being a property of the buffer. |
315 Creating large numbers of buttons can also be somewhat faster using | 320 Creating large numbers of buttons can also be somewhat faster using |
316 `insert-text-button'. | 321 `insert-text-button'. |