From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: finger-pointer curser as default for mouse-face text Date: Tue, 26 Oct 2004 14:23:54 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1098793871 3376 80.91.229.6 (26 Oct 2004 12:31:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Oct 2004 12:31:11 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 26 14:30:56 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CMQTY-0007Ha-00 for ; Tue, 26 Oct 2004 14:30:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMQbE-0000St-UW for ged-emacs-devel@m.gmane.org; Tue, 26 Oct 2004 08:38:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CMQax-0000Pf-5r for emacs-devel@gnu.org; Tue, 26 Oct 2004 08:38:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CMQaw-0000P0-D8 for emacs-devel@gnu.org; Tue, 26 Oct 2004 08:38:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMQaw-0000Og-9R for emacs-devel@gnu.org; Tue, 26 Oct 2004 08:38:34 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1CMQT8-0007Oe-G4 for emacs-devel@gnu.org; Tue, 26 Oct 2004 08:30:31 -0400 Original-Received: (qmail 21695 invoked from network); 26 Oct 2004 12:23:48 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 26 Oct 2004 12:23:48 -0000 Original-To: David Kastrup In-Reply-To: (David Kastrup's message of "Tue, 26 Oct 2004 11:25:01 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28972 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28972 David Kastrup writes: >> If we can safely differentiate between links and non-links I think a >> short click should follow the link (double-clicks typically don't >> make sense there anyway) and a long click should set point > > Well, I happen to disagree, since following a link is the more time > consuming action, anyway, and people might be tempted to press until > the browser window appears. If you keep the button pressed in emacs, the window NEVER appears (as it is the up-event which follows the link), so I doubt users do that. > In any case, neither option is the behavior that a user would guess > without being explicitly introduced to it. So we need to turn it off > by default, or give an explanatory message of some kind by default. Well, if the "normal" click follows the link (and I claim that the normal click is the short click), most users will never think there is a problem, as they don't usually have to set the mouse in the middle of a link. They will probably set it next to the link and move the cursor into the link (that's how it is often done in other applications). Now, the more advanced users will ask (or find out by themselves) that a longer click sets the mouse. That is no different from a lot of other functionality in emacs, where the defaults suit the majority, but can be tweaked by the rest). I really don't think a message is worth the extra code [but if that's a prerequisite to get this installed, I'll do it]. > >> Appended is a patch which uses get-text-property rather than >> get-char-property to ignore overlay mouse-face properties. > > I firmly object to such a course. While we should not let ourselves > be influenced too much by that, with XEmacs there is not even a > distinction between overlays and text properties. The choice between > the two when using Emacs should depend _exclusively_ on whether you > need the association with the text or the buffer, and not on any > chance side effects introduced to accidentally work with some package. True, so it's the wrong solution. What is the right solution? Below is a patch which checks if the "link" has a dont-follow-link property. That requires package authors to adapt their code if they don't want mouse-1 to follow links, but it is a trivial addition... Index: mouse.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v retrieving revision 1.251 diff -c -r1.251 mouse.el *** mouse.el 18 Oct 2004 09:29:26 -0000 1.251 --- mouse.el 26 Oct 2004 12:25:34 -0000 *************** *** 48,53 **** --- 48,81 ---- :type 'boolean :group 'mouse) + (defcustom mouse-1-click-follows-link 300 + "Non-nil means that clicking mouse-1 on a link follows the link. + This is only done for links which have the mouse-face property. + + If value is an positive integer, it specifies the maximum + duration in milli-seconds of the mouse-1 click to be recognized + as a mouse-2 click. If the time between pressing and releasing + the mouse button is longer, the normal mouse-1 command (typically + set point) is performed. + + If value is an negative integer, its absolute value specifies the + minimum duration in milli-seconds of the mouse-1 click to be + recognized as a mouse-2 click. If the time between pressing and + releasing the mouse button is longer, the normal mouse-1 command + is performed. + + Otherwise, mouse-1 unconditionally follows the link, unless you + drag the mouse in the link to run the normal mouse-1 command." + :version "21.4" + :type '(choice (const :tag "Disabled" nil) + (number :tag "Click time limit" :value 300) + (other :tag "Enabled" t)) + :group 'mouse) + ;; Provide a mode-specific menu on a mouse button. *************** *** 877,882 **** --- 905,929 ---- (or end-point (= (window-start start-window) start-window-start))) + (if (and mouse-1-click-follows-link + (not end-point) + (consp event) + (= click-count 0) + (= (event-click-count event) 1) + (not (input-pending-p)) + (get-char-property start-point 'mouse-face) + (not (get-char-property start-point 'dont-follow-link)) + (or (not (integerp mouse-1-click-follows-link)) + (let ((t0 (posn-timestamp (event-start start-event))) + (t1 (posn-timestamp (event-end event)))) + (and (integerp t0) (integerp t1) + (if (> mouse-1-click-follows-link 0) + (<= (- t1 t0) mouse-1-click-follows-link) + (< (- t0 t1) mouse-1-click-follows-link))))) + (or (not double-click-time) + (sit-for 0 (if (integerp double-click-time) + double-click-time 500) t))) + (setcar event 'mouse-2)) (setq unread-command-events (cons event unread-command-events))))) (delete-overlay mouse-drag-overlay))))) -- Kim F. Storm http://www.cua.dk