unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
Subject: Re: lispref/text.texi node "Clickable Text"
Date: 30 Jul 2006 15:44:39 -0400	[thread overview]
Message-ID: <jkmzaqubbs.fsf@glug.org> (raw)
In-Reply-To: <E1G5DI7-0001Qt-1G@fencepost.gnu.org>

Richard Stallman <rms@gnu.org> 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

      reply	other threads:[~2006-07-30 19:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-24  7:10 lispref/text.texi node "Clickable Text" Thien-Thi Nguyen
2006-07-24  7:22 ` Thien-Thi Nguyen
2006-07-24 18:22 ` Richard Stallman
2006-07-25  3:09 ` Richard Stallman
2006-07-30 19:44   ` Thien-Thi Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jkmzaqubbs.fsf@glug.org \
    --to=ttn@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).