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 11:00:26 +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 1098781272 32561 80.91.229.6 (26 Oct 2004 09:01:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 26 Oct 2004 09:01:12 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 26 11:00:55 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 1CMNCI-0000oO-00 for ; Tue, 26 Oct 2004 11:00:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMNJz-0000R0-99 for ged-emacs-devel@m.gmane.org; Tue, 26 Oct 2004 05:08:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CMNJa-0000Q1-4Z for emacs-devel@gnu.org; Tue, 26 Oct 2004 05:08:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CMNJY-0000PC-A2 for emacs-devel@gnu.org; Tue, 26 Oct 2004 05:08:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMNJX-0000P8-So for emacs-devel@gnu.org; Tue, 26 Oct 2004 05:08:24 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1CMNBk-0002z3-LL for emacs-devel@gnu.org; Tue, 26 Oct 2004 05:00:21 -0400 Original-Received: (qmail 53642 invoked from network); 26 Oct 2004 09:00:19 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 26 Oct 2004 09:00:19 -0000 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Mon, 25 Oct 2004 11:35:34 -0400") 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:28959 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28959 Stefan Monnier writes: >> If the time stamps for the clicks indeed come from the X server, then >> Kim's timed scheme would probably not be very susceptible to system >> load/traffic congestion effects. > > The problm with it is that it goes against what we're trying to do, which is > to get Emacs's UI in line with "what non-Emacs users expect". > I.e. such users will just do a simple click and expect it to follow > the link. Yes, that's what we are trying to achieve -- the fundamental problem we discuss here is actually how to recognize when the stuff is a link and when it is something else which has a mouse-face property. In the examples given until now, the non-links have the mouse-face on an overlay -- so maybe to fix would be to only follow link which have the mouse-face as a text property in the buffer. 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 Appended is a patch which uses get-text-property rather than get-char-property to ignore overlay mouse-face properties. The patch also allows you to double click on a link to get the normal double-click action in the buffer rather than following the link. To do that, I wait "double-click-time" milliseconds before following the link -- if any input arrives in that period, I don't follow the link. May feel a little "slow", but it's worth a try. > > Adding a message saying "please keep the button pressed longer if you want > to follow the link" is really not much better than adding a message that > says "use mouse-2 if you want to follow the link". > > And if you add to the equation the extra code and conceptual complexity of > using timing-dependent information, I find it ends up a loser. I don't really want to add any message there -- if we leave the feature disabled by default, the users who turn it on doesn't need to be told how to get the alternative behaviour. If we turn on the feature by default, there should at least be some way to disable that message. > >> After all, we have the same problem with recognizing double-clicks. > > Sure. But users have wanted double-clicks, so we gave it to them. > Users's aren't asking for variable-duration clicks. OTOH users are quite > used to not being able to move cursor into a link by just left-clicking on > it. It may annoy them at times, but it seems to annoy them less than having > to use mouse-2. Variable length clicks are a new user interface invention in emacs :-) 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 08:56:24 -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)) + ;; Don't want to look at overlays here + (get-text-property start-point 'mouse-face) + (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