aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lispref/text.texi38
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
3390global definition) remains available for the rest of the text in the 3389global definition) remains available for the rest of the text in the
3391buffer. 3390buffer.
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
3402customize this behaviour through the variable 3402customize 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
3407that @key{Mouse-1} should also follow the link, here is what you do: 3407indicate that @key{Mouse-1} should also follow the link, here is what
3408you 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}
3481property with a value as specified above to determine how to follow 3482property with a value as specified above to determine how to follow
3482the link. 3483the 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
3487with a value as specified above to determine how to follow the link. 3493with 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
3495For example, here is how the @code{link} widget specifies that
3496a @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