all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: romain@orebokech.com, emacs-devel@gnu.org, "Kim F. Storm" <storm@cua.dk>
Subject: Re: Difficulty with mouse-1-click-follows-link
Date: Thu, 13 Oct 2005 11:33:09 -0400	[thread overview]
Message-ID: <87fyr5e8ju.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1EPv5E-0007yo-6k@fencepost.gnu.org> (Richard M. Stallman's message of "Thu, 13 Oct 2005 00:52:48 -0400")

> 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)

  parent reply	other threads:[~2005-10-13 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-09 17:57 Difficulty with mouse-1-click-follows-link Chong Yidong
2005-10-09 18:51 ` Romain Francoise
2005-10-10 16:46   ` Chong Yidong
2005-10-11 17:16     ` Romain Francoise
2005-10-11 21:04       ` Kim F. Storm
2005-10-11 21:20         ` Chong Yidong
2005-10-12  9:32           ` Kim F. Storm
2005-10-12 13:11             ` Chong Yidong
2005-10-12 13:37               ` Kim F. Storm
2005-10-13  4:52             ` Richard M. Stallman
2005-10-13 14:39               ` Stefan Monnier
2005-10-13 15:33               ` Chong Yidong [this message]
2005-10-14  5:10                 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fyr5e8ju.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=romain@orebokech.com \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.