From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: lispref/text.texi node "Clickable Text" Date: 30 Jul 2006 15:44:39 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1154288690 1913 80.91.229.2 (30 Jul 2006 19:44:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 Jul 2006 19:44:50 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 30 21:44:48 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G7HDN-00071H-2L for ged-emacs-devel@m.gmane.org; Sun, 30 Jul 2006 21:44:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7HDM-0005o7-HM for ged-emacs-devel@m.gmane.org; Sun, 30 Jul 2006 15:44:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G7HDB-0005o1-GK for emacs-devel@gnu.org; Sun, 30 Jul 2006 15:44:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G7HD8-0005ni-WD for emacs-devel@gnu.org; Sun, 30 Jul 2006 15:44:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G7HD8-0005nd-Rl for emacs-devel@gnu.org; Sun, 30 Jul 2006 15:44:26 -0400 Original-Received: from [67.59.132.6] (helo=mail.agora-net.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G7HFe-0008WL-1V for emacs-devel@gnu.org; Sun, 30 Jul 2006 15:47:02 -0400 Original-Received: from ttn by mail.agora-net.com with local (Exim 4.50) id 1G7HDL-00039Z-3c for emacs-devel@gnu.org; Sun, 30 Jul 2006 15:44:39 -0400 Original-To: emacs-devel@gnu.org In-Reply-To: Original-Lines: 75 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57808 Archived-At: Richard Stallman 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