emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difficulty with mouse-1-click-follows-link


From: Chong Yidong
Subject: Re: Difficulty with mouse-1-click-follows-link
Date: Thu, 13 Oct 2005 11:33:09 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> That is important.  Double-click of mouse-1 has a standard meaning,
> and the link-following feature is not supposed to interfere with it.
>
> Whether the old code succeeded in keeping double-click working right,
> I don't know.  But if it doesn't work correctly now, it needs to be
> fixed.

This patch should fix the problem.  I think `mouse-drag-region-1' was
failing to call double-click bindings because it assumed that
double-mouse-1 was bound to `mouse-set-point'.

By the way, there's no need to drop the mouse-1 event if the user
double-clicks (which is what the sit-for was trying to do).  The Elisp
manual says that

   When the user performs a double click, Emacs generates first an
   ordinary click event, and then a double-click event.  Therefore,
   you must design the command binding of the double click event to
   assume that the single-click command has already run.  It must
   produce the desired results of a double click, starting from the
   results of a single click.

This patch should make mouse-1 and double-mouse-1 work as stated.
Could people test it out?


*** emacs/lisp/mouse.el.~1.281.~        2005-10-09 13:59:03.000000000 -0400
--- emacs/lisp/mouse.el 2005-10-13 11:19:30.000000000 -0400
***************
*** 958,969 ****
          (mouse-move-drag-overlay mouse-drag-overlay start-point end-point 
click-count))
  
        (if (consp event)
!         (let ((fun (key-binding (vector (car event)))))
              ;; Run the binding of the terminating up-event, if possible.
              ;; In the case of a multiple click, it gives the wrong results,
            ;; because it would fail to set up a region.
!           (if (not (= (overlay-start mouse-drag-overlay)
!                       (overlay-end mouse-drag-overlay)))
                (let* ((stop-point
                        (if (numberp (posn-point (event-end event)))
                            (posn-point (event-end event))
--- 958,973 ----
          (mouse-move-drag-overlay mouse-drag-overlay start-point end-point 
click-count))
  
        (if (consp event)
!         (let* ((fun (key-binding (vector (car event))))
!                (do-multi-click   (and (> (event-click-count event) 0)
!                                       (functionp fun)
!                                       (not (eq fun 'mouse-set-point)))))
              ;; Run the binding of the terminating up-event, if possible.
              ;; In the case of a multiple click, it gives the wrong results,
            ;; because it would fail to set up a region.
!           (if (and (not (= (overlay-start mouse-drag-overlay)
!                            (overlay-end mouse-drag-overlay)))
!                    (not do-multi-click))
                (let* ((stop-point
                        (if (numberp (posn-point (event-end event)))
                            (posn-point (event-end event))
***************
*** 996,1001 ****
--- 1000,1006 ----
                      (and (mark t) mark-active
                           (eq buffer (current-buffer))
                           (mouse-set-region-1))))
+             (if do-multi-click (goto-char start-point))
                (delete-overlay mouse-drag-overlay)
                ;; Run the binding of the terminating up-event.
                (when (and (functionp fun)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]