Subject: Re: bug#23478: 25.0.93; Mouse region selection asymmetry

From: Stephen Berman <[email-masked]>
Date: Mon, 04 Jul 2016 20:26:59 +0200

On Mon, 04 Jul 2016 18:56:03 +0200 Stephen Berman <[email-masked]> wrote:

> diff --git a/lisp/mouse.el b/lisp/mouse.el
> index 8d72753..39adc42 100644
> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -548,7 +548,11 @@ mouse-set-point
>    (interactive "e\np")
>    (mouse-minibuffer-check event)
>    (if (and promote-to-region (> (event-click-count event) 1))
> -      (mouse-set-region event)
> +      (progn
> +        (mouse-set-region event)
> +        (when (> (window-start) (region-beginning))
> +	  (exchange-point-and-mark)
> +	  (sit-for 0)))
>      ;; Use event-end in case called from mouse-drag-region.
>      ;; If EVENT is a click, event-end and event-start give same value.
>      (posn-set-point (event-end event))))
>
> This makes the bevavior even more like the first situation (i.e., the
> mirror image of it).  So I like this solution even better.  What do you
> think?

That patch only mirrors the first situation when the region begins above
the window; the following always changes point when clicking at what
will be the end point of the region, so this fully mirrors the first
situation, and would be the most symmetrical behavior (unless I'm
overlooking something):

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 8d72753..608a52f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -548,7 +548,11 @@ mouse-set-point
   (interactive "e\np")
   (mouse-minibuffer-check event)
   (if (and promote-to-region (> (event-click-count event) 1))
-      (mouse-set-region event)
+      (progn
+        (mouse-set-region event)
+        (when (> (posn-point (event-start event)) (region-beginning))
+	  (exchange-point-and-mark)
+	  (sit-for 0)))
     ;; Use event-end in case called from mouse-drag-region.
     ;; If EVENT is a click, event-end and event-start give same value.
     (posn-set-point (event-end event))))

Steve Berman