diff options
| author | Miles Bader | 2004-01-01 14:09:01 +0000 |
|---|---|---|
| committer | Miles Bader | 2004-01-01 14:09:01 +0000 |
| commit | a3cb3b2eafb528390459892e580cbf9e601475ea (patch) | |
| tree | 7397d7de7205e181e2187463637a9c9fd7ad5626 | |
| parent | 02c77ee91c2ba77634313783193bbfd18160ec52 (diff) | |
| download | emacs-a3cb3b2eafb528390459892e580cbf9e601475ea.tar.gz emacs-a3cb3b2eafb528390459892e580cbf9e601475ea.zip | |
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-13
Minor tweaks to Buttons section in lispref/display.texi
| -rw-r--r-- | lispref/display.texi | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/lispref/display.texi b/lispref/display.texi index 25aea971638..fc1cdb038ef 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -3404,13 +3404,14 @@ are cleared. | |||
| 3404 | 3404 | ||
| 3405 | @node Buttons | 3405 | @node Buttons |
| 3406 | @section Buttons | 3406 | @section Buttons |
| 3407 | @cindex buttons | ||
| 3407 | @cindex buttons in buffers | 3408 | @cindex buttons in buffers |
| 3408 | @cindex clickable buttons in buffers | 3409 | @cindex clickable buttons in buffers |
| 3409 | 3410 | ||
| 3410 | The @emph{button} package defines functions for inserting and | 3411 | The @emph{button} package defines functions for inserting and |
| 3411 | manipulating clickable (with the mouse, or via keyboard commands) | 3412 | manipulating clickable (with the mouse, or via keyboard commands) |
| 3412 | buttons in Emacs buffers, such as might be used for help hyperlinks, | 3413 | buttons in Emacs buffers, such as might be used for help hyper-links, |
| 3413 | etc. Emacs uses buttons for the hyperlinks in help text and the like. | 3414 | etc. Emacs uses buttons for the hyper-links in help text and the like. |
| 3414 | 3415 | ||
| 3415 | A button is essentially a set of properties attached (via text | 3416 | A button is essentially a set of properties attached (via text |
| 3416 | properties or overlays) to a region of text in an emacs buffer, which | 3417 | properties or overlays) to a region of text in an emacs buffer, which |
| @@ -3434,7 +3435,7 @@ entries). | |||
| 3434 | @menu | 3435 | @menu |
| 3435 | * Button Properties:: Button properties with special meanings. | 3436 | * Button Properties:: Button properties with special meanings. |
| 3436 | * Button Types:: Defining common properties for classes of buttons. | 3437 | * Button Types:: Defining common properties for classes of buttons. |
| 3437 | * Making buttons:: Adding buttons to emacs buffers. | 3438 | * Making Buttons:: Adding buttons to emacs buffers. |
| 3438 | * Manipulating Buttons:: Getting and setting properties of buttons. | 3439 | * Manipulating Buttons:: Getting and setting properties of buttons. |
| 3439 | * Button Buffer Commands:: Buffer-wide commands and bindings for buttons. | 3440 | * Button Buffer Commands:: Buffer-wide commands and bindings for buttons. |
| 3440 | * Manipulating Button Types:: | 3441 | * Manipulating Button Types:: |
| @@ -3454,41 +3455,49 @@ include: | |||
| 3454 | @table @code | 3455 | @table @code |
| 3455 | 3456 | ||
| 3456 | @item action | 3457 | @item action |
| 3458 | @kindex action @r{(button property)} | ||
| 3457 | The function to call when the user invokes the button, which is passed | 3459 | The function to call when the user invokes the button, which is passed |
| 3458 | the single argument @var{button}. By default this is @code{ignore}, | 3460 | the single argument @var{button}. By default this is @code{ignore}, |
| 3459 | which does nothing. | 3461 | which does nothing. |
| 3460 | 3462 | ||
| 3461 | @item mouse-action | 3463 | @item mouse-action |
| 3464 | @kindex mouse-action @r{(button property)} | ||
| 3462 | This is similar to @code{action}, and when present, will be used | 3465 | This is similar to @code{action}, and when present, will be used |
| 3463 | instead of @code{action} for button invocations resulting from | 3466 | instead of @code{action} for button invocations resulting from |
| 3464 | mouse-clicks (instead of the user hitting @key{RET}). If not | 3467 | mouse-clicks (instead of the user hitting @key{RET}). If not |
| 3465 | present, mouse-clicks use @code{action} instead. | 3468 | present, mouse-clicks use @code{action} instead. |
| 3466 | 3469 | ||
| 3467 | @item face | 3470 | @item face |
| 3471 | @kindex face @r{(button property)} | ||
| 3468 | This is an emacs face controlling how buttons of this type are | 3472 | This is an emacs face controlling how buttons of this type are |
| 3469 | displayed; by default this is the @code{button} face. | 3473 | displayed; by default this is the @code{button} face. |
| 3470 | 3474 | ||
| 3471 | @item mouse-face | 3475 | @item mouse-face |
| 3476 | @kindex mouse-face @r{(button property)} | ||
| 3472 | This is an additional face which controls appearance during | 3477 | This is an additional face which controls appearance during |
| 3473 | mouse-overs (merged with the usual button face); by default this is | 3478 | mouse-overs (merged with the usual button face); by default this is |
| 3474 | the usual emacs @code{highlight} face. | 3479 | the usual emacs @code{highlight} face. |
| 3475 | 3480 | ||
| 3476 | @item keymap | 3481 | @item keymap |
| 3482 | @kindex keymap @r{(button property)} | ||
| 3477 | The button's keymap, defining bindings active within the button | 3483 | The button's keymap, defining bindings active within the button |
| 3478 | region. By default this is the usual button region keymap, stored | 3484 | region. By default this is the usual button region keymap, stored |
| 3479 | in the variable @code{button-map}, which defines @key{RET} and | 3485 | in the variable @code{button-map}, which defines @key{RET} and |
| 3480 | @key{down-mouse-1} to invoke the button. | 3486 | @key{down-mouse-1} to invoke the button. |
| 3481 | 3487 | ||
| 3482 | @item type | 3488 | @item type |
| 3489 | @kindex type @r{(button property)} | ||
| 3483 | The button-type of the button. When creating a button, this is | 3490 | The button-type of the button. When creating a button, this is |
| 3484 | usually specified using the @code{:type} keyword argument. | 3491 | usually specified using the @code{:type} keyword argument. |
| 3485 | @xref{Button Types}. | 3492 | @xref{Button Types}. |
| 3486 | 3493 | ||
| 3487 | @item help-echo | 3494 | @item help-echo |
| 3488 | A string displayed by the emacs tooltip help system; by default, | 3495 | @kindex help-index @r{(button property)} |
| 3496 | A string displayed by the emacs tool-tip help system; by default, | ||
| 3489 | @code{"mouse-2, RET: Push this button"}. | 3497 | @code{"mouse-2, RET: Push this button"}. |
| 3490 | 3498 | ||
| 3491 | @item button | 3499 | @item button |
| 3500 | @kindex button @r{(button property)} | ||
| 3492 | All buttons have a non-@code{nil} @code{button} property, which may be useful | 3501 | All buttons have a non-@code{nil} @code{button} property, which may be useful |
| 3493 | in finding regions of text that comprise buttons (which is what the | 3502 | in finding regions of text that comprise buttons (which is what the |
| 3494 | standard button functions do). | 3503 | standard button functions do). |
| @@ -3502,10 +3511,10 @@ button, but these are not generally interesting for typical uses. | |||
| 3502 | @cindex button types | 3511 | @cindex button types |
| 3503 | 3512 | ||
| 3504 | Every button has a button @emph{type}, which defines default values | 3513 | Every button has a button @emph{type}, which defines default values |
| 3505 | for the button's properties; button types are arranged in a hierarchy, | 3514 | for the button's properties. Button types are arranged in a |
| 3506 | with specialized types inheriting from more general types, so that | 3515 | hierarchy, with specialized types inheriting from more general types, |
| 3507 | it's easy to define special-purpose types of buttons for specific | 3516 | so that it's easy to define special-purpose types of buttons for |
| 3508 | tasks. | 3517 | specific tasks. |
| 3509 | 3518 | ||
| 3510 | @defun define-button-type name &rest properties | 3519 | @defun define-button-type name &rest properties |
| 3511 | @tindex define-button-type | 3520 | @tindex define-button-type |
| @@ -3523,11 +3532,12 @@ reflected in its subtypes. | |||
| 3523 | @end defun | 3532 | @end defun |
| 3524 | 3533 | ||
| 3525 | Using @code{define-button-type} to define default properties for | 3534 | Using @code{define-button-type} to define default properties for |
| 3526 | buttons is not necessary, but it is is encouraged, since doing so | 3535 | buttons is not necessary---buttons without any specified type use the |
| 3527 | usually makes the resulting code clearer and more efficient. | 3536 | built-in button-type @code{button}---but it is is encouraged, since |
| 3537 | doing so usually makes the resulting code clearer and more efficient. | ||
| 3528 | 3538 | ||
| 3529 | @node Making buttons | 3539 | @node Making Buttons |
| 3530 | @subsection Making buttons | 3540 | @subsection Making Buttons |
| 3531 | @cindex making buttons | 3541 | @cindex making buttons |
| 3532 | 3542 | ||
| 3533 | Buttons are associated with a region of text, using an overlay or | 3543 | Buttons are associated with a region of text, using an overlay or |
| @@ -3624,9 +3634,8 @@ Set @var{button}'s @var{prop} property to @var{val}. | |||
| 3624 | @tindex button-activate | 3634 | @tindex button-activate |
| 3625 | Call @var{button}'s @code{action} property (i.e., invoke it). If | 3635 | Call @var{button}'s @code{action} property (i.e., invoke it). If |
| 3626 | @var{use-mouse-action} is non-@code{nil}, try to invoke the button's | 3636 | @var{use-mouse-action} is non-@code{nil}, try to invoke the button's |
| 3627 | @code{mouse-action} property instead of @code{action}, but if the | 3637 | @code{mouse-action} property instead of @code{action}; if the button |
| 3628 | button has no @code{mouse-action} property, use @code{action} as | 3638 | has no @code{mouse-action} property, use @code{action} as normal. |
| 3629 | normal. | ||
| 3630 | @end defun | 3639 | @end defun |
| 3631 | 3640 | ||
| 3632 | @defun button-label button | 3641 | @defun button-label button |
| @@ -3670,12 +3679,13 @@ parent keymap for its keymap. | |||
| 3670 | @tindex push-button | 3679 | @tindex push-button |
| 3671 | Perform the action specified by a button at location @var{pos}. | 3680 | Perform the action specified by a button at location @var{pos}. |
| 3672 | @var{pos} may be either a buffer position or a mouse-event. If | 3681 | @var{pos} may be either a buffer position or a mouse-event. If |
| 3673 | @var{use-mouse-action} is non-@code{nil}, try to invoke the button's | 3682 | @var{use-mouse-action} is non-@code{nil}, or @var{pos} is a |
| 3674 | @code{mouse-action} property instead of @code{action}, but if the | 3683 | mouse-event (@pxref{Mouse Events}), try to invoke the button's |
| 3675 | button has no @code{mouse-action} property, use @code{action} as | 3684 | @code{mouse-action} property instead of @code{action}; if the button |
| 3676 | normal. @var{pos} defaults to point, except when `push-button' is | 3685 | has no @code{mouse-action} property, use @code{action} as normal. |
| 3677 | invoked interactively as the result of a mouse-event, in which case, | 3686 | @var{pos} defaults to point, except when @code{push-button} is invoked |
| 3678 | the mouse event is used. If there's no button at @var{pos}, do | 3687 | interactively as the result of a mouse-event, in which case, the mouse |
| 3688 | event's position is used. If there's no button at @var{pos}, do | ||
| 3679 | nothing and return @code{nil}, otherwise return @code{t}. | 3689 | nothing and return @code{nil}, otherwise return @code{t}. |
| 3680 | @end deffn | 3690 | @end deffn |
| 3681 | 3691 | ||
| @@ -3686,8 +3696,8 @@ Move to the @var{n}th next button, or @var{n}th previous button if | |||
| 3686 | button at point. If @var{wrap} is non-@code{nil}, moving past either | 3696 | button at point. If @var{wrap} is non-@code{nil}, moving past either |
| 3687 | end of the buffer continues from the other end. If | 3697 | end of the buffer continues from the other end. If |
| 3688 | @var{display-message} is non-@code{nil}, the button's help-echo string | 3698 | @var{display-message} is non-@code{nil}, the button's help-echo string |
| 3689 | is displayed. Any button with a non-@code{nil} `skip' property is | 3699 | is displayed. Any button with a non-@code{nil} @code{skip} property |
| 3690 | skipped over. Returns the button found. | 3700 | is skipped over. Returns the button found. |
| 3691 | @end deffn | 3701 | @end deffn |
| 3692 | 3702 | ||
| 3693 | @deffn Command backward-button n &optional wrap display-message | 3703 | @deffn Command backward-button n &optional wrap display-message |
| @@ -3697,8 +3707,8 @@ Move to the @var{n}th previous button, or @var{n}th next button if | |||
| 3697 | button at point. If @var{wrap} is non-@code{nil}, moving past either | 3707 | button at point. If @var{wrap} is non-@code{nil}, moving past either |
| 3698 | end of the buffer continues from the other end. If | 3708 | end of the buffer continues from the other end. If |
| 3699 | @var{display-message} is non-@code{nil}, the button's help-echo string | 3709 | @var{display-message} is non-@code{nil}, the button's help-echo string |
| 3700 | is displayed. Any button with a non-@code{nil} `skip' property is | 3710 | is displayed. Any button with a non-@code{nil} @code{skip} property |
| 3701 | skipped over. Returns the button found. | 3711 | is skipped over. Returns the button found. |
| 3702 | @end deffn | 3712 | @end deffn |
| 3703 | 3713 | ||
| 3704 | @defun next-button pos &optional count-current | 3714 | @defun next-button pos &optional count-current |