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: Wed, 27 Oct 2004 14:32:32 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <86ekjkvd5d.fsf@ketchup.de.uu.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1098880779 21900 80.91.229.6 (27 Oct 2004 12:39:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Oct 2004 12:39:39 +0000 (UTC) Cc: Kai Grossjohann , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 27 14:39:29 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 1CMn5N-0008Nv-00 for ; Wed, 27 Oct 2004 14:39:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMnD7-0008KQ-KA for ged-emacs-devel@m.gmane.org; Wed, 27 Oct 2004 08:47:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CMnCt-0008JB-QP for emacs-devel@gnu.org; Wed, 27 Oct 2004 08:47:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CMnCs-0008Ib-Vv for emacs-devel@gnu.org; Wed, 27 Oct 2004 08:47:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CMnCs-0008IV-SQ for emacs-devel@gnu.org; Wed, 27 Oct 2004 08:47:14 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1CMn52-0005Ww-Ez for emacs-devel@gnu.org; Wed, 27 Oct 2004 08:39:08 -0400 Original-Received: (qmail 37902 invoked from network); 27 Oct 2004 12:32:26 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 27 Oct 2004 12:32:26 -0000 Original-To: David Kastrup In-Reply-To: (David Kastrup's message of "Wed, 27 Oct 2004 09:35:09 +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:29048 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29048 David Kastrup writes: > I think that nobody will complain if a double click on a link will > cause it to execute instead of marking a word or line. It is indeed > rare that you need to mark a work from inside a link; and if you do, > you can do it by normal dragging marking without much additional > hassle. It was a little more complex to implement than the previous methods, but here is a patch which adds 'double click' support as a user option: 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 27 Oct 2004 12:29:31 -0000 *************** *** 48,53 **** --- 48,77 ---- :type 'boolean :group 'mouse) + (defcustom mouse-1-click-follows-link 'double + "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 the symbol double, a double click follows the link. + + If value is an integer, the time between pressing and releasing + the mouse button determines whether to follow the link or perform + the normal mouse-1 action (typically set point). The absolute + numeric value specifices the maximum duration of a \"short click\" + in milli-seconds. A positive value means that a short click + follows the link, and a longer click performs the normal action. + A negative value specifies the opposite behaviour. + + Otherwise, a single mouse-1 click unconditionally follows the link. + + Note that dragging the mouse never follows the link." + :version "21.4" + :type '(choice (const :tag "Disabled" nil) + (const :tag "Double click" double) + (number :tag "Single click time limit" :value 300) + (other :tag "Single click" t)) + :group 'mouse) + ;; Provide a mode-specific menu on a mouse button. *************** *** 731,736 **** --- 755,764 ---- (run-hooks 'mouse-leave-buffer-hook) (mouse-drag-region-1 start-event)))) + (defun mouse-on-link-p (pos) + (and (get-char-property pos 'mouse-face) + (not (get-char-property pos 'dont-follow-link)))) + (defun mouse-drag-region-1 (start-event) (mouse-minibuffer-check start-event) (let* ((echo-keystrokes 0) *************** *** 746,751 **** --- 774,780 ---- (nth 3 bounds) ;; Don't count the mode line. (1- (nth 3 bounds)))) + on-link remap-double-click (click-count (1- (event-click-count start-event)))) (setq mouse-selection-click-count click-count) (setq mouse-selection-click-count-buffer (current-buffer)) *************** *** 755,760 **** --- 784,796 ---- (if (< (point) start-point) (goto-char start-point)) (setq start-point (point)) + (setq on-link (and mouse-1-click-follows-link + (mouse-on-link-p start-point))) + (setq remap-double-click (and on-link + (eq mouse-1-click-follows-link 'double) + (= click-count 1))) + (if remap-double-click ;; Don't expand mouse overlay in links + (setq click-count 0)) (let ((range (mouse-start-end start-point start-point click-count))) (move-overlay mouse-drag-overlay (car range) (nth 1 range) (window-buffer start-window)) *************** *** 877,882 **** --- 913,938 ---- (or end-point (= (window-start start-window) start-window-start))) + (if (and on-link + (not end-point) + (consp event) + (or remap-double-click + (and + (not (eq mouse-1-click-follows-link 'double)) + (= click-count 0) + (= (event-click-count event) 1) + (not (input-pending-p)) + (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