From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#23478: 25.0.93; Mouse region selection asymmetry Date: Sun, 08 May 2016 21:41:19 +0200 Message-ID: <87shxswd5s.fsf@gmx.net> References: <878tzky2oe.fsf@gmx.net> <83eg9cecy2.fsf@gnu.org> <87wpn4wgev.fsf@gmx.net> <8360uoe5ye.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462736595 9340 80.91.229.3 (8 May 2016 19:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 May 2016 19:43:15 +0000 (UTC) Cc: 23478@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 08 21:43:03 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1azUbV-0005IF-Lh for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 May 2016 21:43:01 +0200 Original-Received: from localhost ([::1]:37865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azUbU-0000hD-RP for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 May 2016 15:43:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azUac-0007XW-F1 for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 15:42:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azUaY-0006Fj-35 for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 15:42:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azUaX-0006Ff-WE for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 15:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1azUaX-0008Hh-S9 for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 15:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 May 2016 19:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23478 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23478-submit@debbugs.gnu.org id=B23478.146273649131805 (code B ref 23478); Sun, 08 May 2016 19:42:01 +0000 Original-Received: (at 23478) by debbugs.gnu.org; 8 May 2016 19:41:31 +0000 Original-Received: from localhost ([127.0.0.1]:43481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azUa2-0008Gv-Vk for submit@debbugs.gnu.org; Sun, 08 May 2016 15:41:31 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:60274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azUa0-0008Gg-TT for 23478@debbugs.gnu.org; Sun, 08 May 2016 15:41:29 -0400 Original-Received: from rosalinde ([89.245.107.13]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0LvVYZ-1bgd4E2V1v-010gCy; Sun, 08 May 2016 21:41:21 +0200 In-Reply-To: <8360uoe5ye.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 May 2016 21:54:17 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) X-Provags-ID: V03:K0:SXdKb+xLaaaDHJriipv2P5yCCh484JcLBi5TffNue/Q7V9mznXr UZ51J1htDd4AsbCNkraOHQ3THBs3HA+qsmGLhWqp4lm2Q5Fo81RyateUdwpCNVd/YkXdQzT 6BtKH7whXfikLQ94FW2P1nZg/DpRutmCvHFxC7YF9t/qd6X3ZOjcLfH7uiJZ4zDn6zMHIkA osvboouJLIjt0i6lYDqYg== X-UI-Out-Filterresults: notjunk:1;V01:K0:8syMQJ96+1c=:R/aPCqm5CWCO50qsl2Ohl2 gZgTDJISv6QZpv11hWF5bEoDaoPaU1cJ7PUhI5yjmQxX23MRWwOlLWCV6qzEdyV0gDwcDuB7J Oh83mO09i2B6E6IucpHFVGqRYfeNTYzepIJCuuEqJsuxKB6Tu/5ybwOiMFsyyVARvZJT3IiQ+ Uxl4A/4d1N7ALAeGbBLI+nxrR8k+PIumHxRTs5hdUeHPG70BLwPCOgtZvPxGX0afRdguhtelk hYATYcQnr3nrtHam0NXJYPX5v3hQ28SdR2MzUuk6zwjNUeqAVa9y/x5hQgblXerPPDajiKwBc eLso7QE1JKAN/kcimf3qO50N9z7WWcSdjyyL+HfFillrDlqrKt3VNQMsojn7CPKlXSIAfWIUY 0JeXxCDNJ8838PWHzeGhztRTOGN66pgaF0XzFpI+9o0bIeqdIlg994LC8sct7N0awJgfElEnU MY0MBT+EKFkL+u9vNtNYKH6mJeTJEu3eIJAHoFuXDCEien4/34L1F4/cE9UFt8HWv7kJ5OhCj U57RXW8t0UhAYKHsvZgUmNfVaw91E204xDUy9Pbx4m528n8yLamDgaI8x0BfXppmIDKV83gcn hTWXRx5CqE6c2tFf8uNTRu97N/QsTH7dwOUF41uOFLP5n1PUQPw3wQgGm4eUa+w2XHxylWyHB m55YK/jy4J12NV2THC93ngIY4baoX5+/tzdEDpcKlklVN5z1WK1svIavCieZgyfYuQp3JWZDc 8sdB9tgvRyFpQXSk2MZiw8ITc1b8soKnbQE6MGmXrmpaiwZlRjZ9sXP9rgwgTz275gK0DjBK X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117996 Archived-At: On Sun, 08 May 2016 21:54:17 +0300 Eli Zaretskii wrote: >> From: Stephen Berman >> Cc: 23478@debbugs.gnu.org >> Date: Sun, 08 May 2016 20:31:04 +0200 >> >> > I don't think calling 'recenter' is TRT. First, the fact that you see >> > the display recentering after item 3 in your recipe is only the >> > default behavior; if you set scroll-conservatively to 101 before >> > repeating your recipe, you will see that Emacs instead scrolls the >> > display just one line, i.e. the minimum amount required to bring point >> > back into view. Users that set scroll-conservatively like that will >> > lynch us if we recenter display in this situation. >> >> Good point, I think I had that vaguely in mind when I expressed my >> doubts about `recenter', but couldn't remember just what needed to be >> taken account of. I did try an alternative to `recenter', using >> `goto-char' instead, which changes point and hence induces recentering >> by redisplay, but it also loses the region highlighting. I tried (with >> several variants involving redisplay-highlight-region-function and >> redisplay--update-region-highlight) but failed to figure out how to keep >> the highlighting, but if that's a better way to handle this, maybe >> someone more familiar with the region highlighting code will be able to >> do that. >> >> > Bottom line, I don't think we should behave like that by default. I >> > think this could be an optional feature, but it must obey >> > scroll-conservatively (and maybe also other related variables). >> >> Definitely. Thanks for the feedback. > > How about momentarily exchanging mark and point, then calling sit-for > for some small time interval, then exchanging back? Shouldn't this do > what you want, or at least come close? I didn't think of that, but it looks like it does the trick. It also behaves well with scroll-conservatively. Thanks! Do you really think this should be conditioned by a user option? I'd be surprised if some people prefer the existing behavior or there's any code that relies on it. Can you think of any gotchas? Steve Berman diff --git a/lisp/mouse.el b/lisp/mouse.el index fa355ff..d256393 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -531,7 +531,12 @@ 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.01) + (exchange-point-and-mark))) ;; 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))))