From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#50256: thing-at-mouse Date: Fri, 03 Sep 2021 14:06:22 +0300 Message-ID: <83v93hyl3l.fsf@gnu.org> References: <87sfys6ubm.fsf@mail.linkov.net> <871r6a8ooe.fsf@gnus.org> <87y28i85xi.fsf@mail.linkov.net> <87k0k1o5ks.fsf@mail.linkov.net> <87ilzk6bsr.fsf@mail.linkov.net> <6dcf3191-dbb3-0c6c-2483-0fc05e9ff6e5@gmx.at> <83lf4gqyn9.fsf@gnu.org> <1a65f234-c1ee-ae95-aa05-2e3d9d1e1002@gmx.at> <8335qoqobm.fsf@gnu.org> <7c9cb0a1-b222-cb06-7e7c-7f17231faca3@gmx.at> <83pmtsp4g1.fsf@gnu.org> <831r67ph8d.fsf@gnu.org> <87tuj3bffb.fsf@gnus.org> <83y28fo1xf.fsf@gnu.org> <191e9cc6-7370-5b7d-7777-716b61e0155d@gmx.at> <83pmtrnydh.fsf@gnu.org> <158a8854-f56a-9aaa-3a14-d108e086a24c@gmx.at> <83k0jznms2.fsf@gnu.org> <87v93j9dfz.fsf@mail.linkov.net> <87y28e4ysv.fsf@mail.linkov.net> <83czpqzupp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37679"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50256@debbugs.gnu.org, larsi@gnus.org, juri@linkov.net To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 03 13:07:20 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mM72W-0009bU-08 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Sep 2021 13:07:20 +0200 Original-Received: from localhost ([::1]:51516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mM72U-00040t-EJ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Sep 2021 07:07:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mM72E-00040k-7l for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 07:07:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mM72E-00089f-0N for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 07:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mM72D-0004MV-SJ for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 07:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Sep 2021 11:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50256 X-GNU-PR-Package: emacs Original-Received: via spool by 50256-submit@debbugs.gnu.org id=B50256.163066719316732 (code B ref 50256); Fri, 03 Sep 2021 11:07:01 +0000 Original-Received: (at 50256) by debbugs.gnu.org; 3 Sep 2021 11:06:33 +0000 Original-Received: from localhost ([127.0.0.1]:43132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mM71l-0004Ll-BN for submit@debbugs.gnu.org; Fri, 03 Sep 2021 07:06:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mM71k-0004LX-2u for 50256@debbugs.gnu.org; Fri, 03 Sep 2021 07:06:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54200) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mM71e-0007ZG-Fz; Fri, 03 Sep 2021 07:06:26 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4261 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mM71e-0003h7-35; Fri, 03 Sep 2021 07:06:26 -0400 In-Reply-To: (message from martin rudalics on Fri, 3 Sep 2021 09:40:36 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:213355 Archived-At: > Cc: 50256@debbugs.gnu.org, larsi@gnus.org > From: martin rudalics > Date: Fri, 3 Sep 2021 09:40:36 +0200 > > If in the manual we say "The argument POSITION defaults to the current > position of point in WINDOW", this means that the window should win. > Whether that's reasonable is another question. Note that a similar > disputable case already happens when we do > > (pos-visible-in-window-p nil (next-window) t) > > and the next window does not show the current buffer. We there silently > override the "nil" with WINDOW's point. Maybe we should signal an error > in either of these cases when WINDOW's buffer is not the current buffer. > > IIUC we use `pos-visible-in-window-p' mainly for three purposes: > > (1) Detect whether a buffer position that typically does _not_ equal > window point is visible in window and, if it isn't, do something > (scroll, enlarge the window) to make it visible. > > (2) Detect whether window point is only partially visible. > > (3) Get the coordinates of window point and move the mouse or pop up a > menu there. > > In all these cases, callers simply don't care about which buffer is > current when calling the function - the buffer in question is WINDOW's > buffer. > > A different use were to check whether a position of an arbitrary BUFFER > would be visible in a WINDOW if BUFFER were displayed there with the > start of the window set to some valid BUFFER position. I don't know > whether anyone ever used such a functionality. To make it work, a > caller would have to set WINDOW's buffer and start position first, call > `pos-visible-in-window-p' and restore the original state afterwards. > Even in this hypothetical case, the caller wouldn't care about which > buffer is current. Thanks. There's one more use case I can think of: when WINDOW is not a selected one, but its buffer is also displayed in the selected window, which could mean its point is different from WINDOW's point. Anyway, after thinking for some time about this, I concluded that the only sane way forward, especially since we are going to cut the emacs-28 branch soon, is to leave the default behavior of pos-visible-in-window-p and posn-at-point as it is today, and add one more optional argument to force the possible alternative behavior(s). The proposed change to event-start and event-end are new code, so they should have no trouble passing this new optional argument to posn-at-point. That means to add an argument to pos-visible-in-window-p that would cause it to select one of the following 3 alternatives: WINDOW's point, WINDOW's buffer's point, and (in case WINDOW is the selected window) the current buffer's point. The default should stay as it is today: when WINDOW is the selected window, use the current buffer's point. Anything else IMNSHO risks introducing many bugs into existing well-tested code that we will never be able to discover and fix in time for Emacs 28.1 release.