diff options
| author | Kim F. Storm | 2005-01-12 15:32:47 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-01-12 15:32:47 +0000 |
| commit | 5364b27cbf68a7a221bb005c797ff1fc800a6d35 (patch) | |
| tree | 0b18ab3348cfd4ee8791770386c9e60ce3ddcb74 | |
| parent | 37181fc463f4357642ca7eab41d283d84b00c1ef (diff) | |
| download | emacs-5364b27cbf68a7a221bb005c797ff1fc800a6d35.tar.gz emacs-5364b27cbf68a7a221bb005c797ff1fc800a6d35.zip | |
(Links and Mouse-1): Rename section from Enabling
Mouse-1 to Following Links. Change xrefs.
Add examples for define-button-type and define-widget.
| -rw-r--r-- | lispref/text.texi | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/lispref/text.texi b/lispref/text.texi index 5c7b11953a3..9807fda05dd 100644 --- a/lispref/text.texi +++ b/lispref/text.texi | |||
| @@ -2431,8 +2431,7 @@ along with the characters; this includes such diverse functions as | |||
| 2431 | only when text is examined. | 2431 | only when text is examined. |
| 2432 | * Clickable Text:: Using text properties to make regions of text | 2432 | * Clickable Text:: Using text properties to make regions of text |
| 2433 | do something when you click on them. | 2433 | do something when you click on them. |
| 2434 | * Enabling Mouse-1 to Follow Links:: | 2434 | * Links and Mouse-1:: How to make @key{Mouse-1} follow a link. |
| 2435 | How to make @key{mouse-1} follow a link. | ||
| 2436 | * Fields:: The @code{field} property defines | 2435 | * Fields:: The @code{field} property defines |
| 2437 | fields within the buffer. | 2436 | fields within the buffer. |
| 2438 | * Not Intervals:: Why text properties do not use | 2437 | * Not Intervals:: Why text properties do not use |
| @@ -3390,9 +3389,10 @@ clickable pieces of text. Also, the major mode definition (or the | |||
| 3390 | global definition) remains available for the rest of the text in the | 3389 | global definition) remains available for the rest of the text in the |
| 3391 | buffer. | 3390 | buffer. |
| 3392 | 3391 | ||
| 3393 | @node Enabling Mouse-1 to Follow Links | 3392 | @node Links and Mouse-1 |
| 3394 | @subsection Enabling Mouse-1 to Follow Links | 3393 | @subsection Links and Mouse-1 |
| 3395 | @cindex follow links | 3394 | @cindex follow links |
| 3395 | @cindex mouse-1 | ||
| 3396 | 3396 | ||
| 3397 | The normal Emacs command for activating text in read-only buffers is | 3397 | The normal Emacs command for activating text in read-only buffers is |
| 3398 | @key{Mouse-2}, which includes following textual links. However, most | 3398 | @key{Mouse-2}, which includes following textual links. However, most |
| @@ -3402,9 +3402,10 @@ click on a link quickly without moving the mouse. The user can | |||
| 3402 | customize this behaviour through the variable | 3402 | customize this behaviour through the variable |
| 3403 | @code{mouse-1-click-follows-link}. | 3403 | @code{mouse-1-click-follows-link}. |
| 3404 | 3404 | ||
| 3405 | To define text as a link at the Lisp level, you should bind | 3405 | To define text as a link at the Lisp level, you should bind the |
| 3406 | @key{Mouse-2} to a command to follow the link. Then, to indicate | 3406 | @code{mouse-2} event to a command to follow the link. Then, to |
| 3407 | that @key{Mouse-1} should also follow the link, here is what you do: | 3407 | indicate that @key{Mouse-1} should also follow the link, here is what |
| 3408 | you do: | ||
| 3408 | 3409 | ||
| 3409 | @table @asis | 3410 | @table @asis |
| 3410 | @item @code{follow-link} property | 3411 | @item @code{follow-link} property |
| @@ -3479,13 +3480,30 @@ translated into a @code{mouse-2} event at the same position. | |||
| 3479 | To define @key{Mouse-1} to activate a button defined with | 3480 | To define @key{Mouse-1} to activate a button defined with |
| 3480 | @code{define-button-type}, give the button a @code{follow-link} | 3481 | @code{define-button-type}, give the button a @code{follow-link} |
| 3481 | property with a value as specified above to determine how to follow | 3482 | property with a value as specified above to determine how to follow |
| 3482 | the link. | 3483 | the link. For example, here is how Help mode handles @key{Mouse-1}: |
| 3483 | @c ??? That is not clear. This needs an example or an xref. | 3484 | |
| 3485 | @smallexample | ||
| 3486 | (define-button-type 'help-xref | ||
| 3487 | 'follow-link t | ||
| 3488 | 'action #'help-button-action) | ||
| 3489 | @end smallexample | ||
| 3484 | 3490 | ||
| 3485 | To define @key{Mouse-1} on a widget defined with | 3491 | To define @key{Mouse-1} on a widget defined with |
| 3486 | @code{define-widget}, give the widget a @code{:follow-link} property | 3492 | @code{define-widget}, give the widget a @code{:follow-link} property |
| 3487 | with a value as specified above to determine how to follow the link. | 3493 | with a value as specified above to determine how to follow the link. |
| 3488 | @c ??? That is not clear. This needs an example or an xref. | 3494 | |
| 3495 | For example, here is how the @code{link} widget specifies that | ||
| 3496 | a @key{Mouse-1} click shall be translated to @key{RET}: | ||
| 3497 | |||
| 3498 | @smallexample | ||
| 3499 | (define-widget 'link 'item | ||
| 3500 | "An embedded link." | ||
| 3501 | :button-prefix 'widget-link-prefix | ||
| 3502 | :button-suffix 'widget-link-suffix | ||
| 3503 | :follow-link "\C-m" | ||
| 3504 | :help-echo "Follow the link." | ||
| 3505 | :format "%[%t%]") | ||
| 3506 | @end smallexample | ||
| 3489 | 3507 | ||
| 3490 | @defun mouse-on-link-p pos | 3508 | @defun mouse-on-link-p pos |
| 3491 | @tindex mouse-on-link-p | 3509 | @tindex mouse-on-link-p |