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: Sun, 24 Oct 2004 14:42:03 +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 1098621762 14279 80.91.229.6 (24 Oct 2004 12:42:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 24 Oct 2004 12:42:42 +0000 (UTC) Cc: drew.adams@oracle.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 24 14:42:32 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 1CLhhg-0006U3-00 for ; Sun, 24 Oct 2004 14:42:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CLhpG-0005vL-TP for ged-emacs-devel@m.gmane.org; Sun, 24 Oct 2004 08:50:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CLhp5-0005uh-7g for emacs-devel@gnu.org; Sun, 24 Oct 2004 08:50:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CLhp4-0005u8-N4 for emacs-devel@gnu.org; Sun, 24 Oct 2004 08:50:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CLhp4-0005u4-JX for emacs-devel@gnu.org; Sun, 24 Oct 2004 08:50:10 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CLhh9-0005PX-Sa; Sun, 24 Oct 2004 08:42:00 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 3D16947FE62; Sun, 24 Oct 2004 14:41:57 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sat, 23 Oct 2004 00:48:35 -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:28826 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28826 Richard Stallman writes: > Maybe it is good enough to be able to drag the mouse into the area > and then release it and ignore the mark setting that it made. > > This is the sort of change for which we need to conduct a poll of the > users. I found a simpler solution which works really well, as it provides the fallback directly on mouse-1 itself: Measure the time between the mouse-1 down event and the up event, and if it less than 300 ms (configurable), follow the link, else do what mouse-1 normally does. So a "fast" click follows the link, a slightly slower click sets the point (or whatever mouse-1 does). Dragging the mouse also inhibits following the link. Here is a patch: 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 24 Oct 2004 12:38:38 -0000 *************** *** 48,53 **** --- 48,66 ---- :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 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 action, e.g. set point, is performed." + :version "21.4" + :type '(choice (const :tag "Disabled" nil) + (number :tag "Max. click time" :value 300) + (other :tag "Enabled" t))) + ;; Provide a mode-specific menu on a mouse button. *************** *** 877,882 **** --- 890,905 ---- (or end-point (= (window-start start-window) start-window-start))) + (if (and mouse-1-click-follows-link + (not end-point) + (consp event) + (get-char-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) + (<= (- t1 t0) mouse-1-click-follows-link))))) + (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