[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lispref/text.texi node "Clickable Text"
From: |
Thien-Thi Nguyen |
Subject: |
Re: lispref/text.texi node "Clickable Text" |
Date: |
30 Jul 2006 15:44:39 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Richard Stallman <address@hidden> writes:
> I clarified that text. Please do update the examples.
following is a patch that updates the examples and their
associated explanations. i also enlarged the concept of the
first step in the first paragraph, which touches upon your
recent clarification, which is why i post it for review.
thi
________________________________________________________
*** text.texi 30 Jul 2006 12:34:23 -0000 1.127
--- text.texi 30 Jul 2006 19:39:44 -0000
***************
*** 3480,3505 ****
@cindex clickable text
There are two parts of setting up @dfn{clickable text} in a buffer:
! (1) to make that text highlight when the mouse moves over it, and (2)
to make a mouse button do something when you click on that text.
! For highlighting, use the @code{mouse-face} text property. Here is
! an example of how Dired does it:
@smallexample
(condition-case nil
(if (dired-move-to-filename)
! (put-text-property (point)
! (save-excursion
! (dired-move-to-end-of-filename)
! (point))
! 'mouse-face 'highlight))
(error nil))
@end smallexample
@noindent
! The first two arguments to @code{put-text-property} specify the
! beginning and end of the text.
The usual way to make the mouse do something when you click it
on this text is to define @code{mouse-2} in the major mode's
--- 3480,3511 ----
@cindex clickable text
There are two parts of setting up @dfn{clickable text} in a buffer:
! (1) to indicate clickability when the mouse moves over the text, and (2)
to make a mouse button do something when you click on that text.
! Indicating clickability usually involves highlighting the text, and
! often involves displaying helpful information about the action, such
! as which mouse button to press, or a short summary of the action.
! This can be done with the @code{mouse-face} and @code{help-echo}
! text properties. @xref{Special Properties}.
! Here is an example of how Dired does it:
@smallexample
(condition-case nil
(if (dired-move-to-filename)
! (add-text-properties
! (point)
! (save-excursion
! (dired-move-to-end-of-filename)
! (point))
! '(mouse-face highlight
! help-echo "mouse-2: visit this file in other window")))
(error nil))
@end smallexample
@noindent
! The first two arguments to @code{add-text-properties} specify the
! beginning and end of the text.
The usual way to make the mouse do something when you click it
on this text is to define @code{mouse-2} in the major mode's