From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#50256: thing-at-mouse Date: Sat, 4 Sep 2021 13:10:43 +0200 Message-ID: <087851c3-b3b1-5130-f4b1-50cd42ef83a8@gmx.at> 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> <83v93hyl3l.fsf@gnu.org> <83sfykwyyb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------BB4D7116E7F8A9E9415B3D4E" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14072"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50256@debbugs.gnu.org, larsi@gnus.org, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 04 13:11:15 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 1mMTZr-0003Vv-7C for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Sep 2021 13:11:15 +0200 Original-Received: from localhost ([::1]:35462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMTZp-0000OW-Lj for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Sep 2021 07:11:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMTZe-0000M0-NM for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 07:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMTZe-0006nX-Fi for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 07:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMTZe-0007SY-4k for bug-gnu-emacs@gnu.org; Sat, 04 Sep 2021 07:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Sep 2021 11:11:02 +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.163075385428659 (code B ref 50256); Sat, 04 Sep 2021 11:11:02 +0000 Original-Received: (at 50256) by debbugs.gnu.org; 4 Sep 2021 11:10:54 +0000 Original-Received: from localhost ([127.0.0.1]:46758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMTZV-0007SB-Ss for submit@debbugs.gnu.org; Sat, 04 Sep 2021 07:10:54 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:43757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMTZU-0007Ry-Nf for 50256@debbugs.gnu.org; Sat, 04 Sep 2021 07:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630753845; bh=+A/D+Ozn7Vg7OyCgz1E3WU2MgBrVdVCYQtIvj3y3aX0=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=J2IK/Mttp31J7aMhF6UXwZ8jC7CpnIcvsPokkVRwCTTY+rMNlpjQ8UC63p/dsmRhk +6zsfsLlno53+Je4Xn5eCPFPLv82N7OLMDjDodFhy9nyG2S+DFpZonmTDGOF+qU/hA n5ilGRotDAoKaiLAqfnvKxlBGuTlm4gjKUDc62Rc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([212.95.5.122]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MBm1e-1mH0yv1fu0-00CEL9; Sat, 04 Sep 2021 13:10:45 +0200 In-Reply-To: <83sfykwyyb.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:+xrVcd+frfgNb36bSpZFn/kbZYw6OOu4Tud26ypcRqDjq8QRnJu 4Ziidff+CopyVLKOpd6WPFMXiAqFo+tpGuNl574bSp/xoz8IQy5NZTb/knMMgcSPHhH1uJh lDlIJtwkyUsBxCCYq8xdmN4dYcFo+3G1RSKrEYnMCPI1KjeIgrIKN/G7KWEzsnG2iBN6YK0 o+K+st02AGmpGpIX4CfUg== X-UI-Out-Filterresults: notjunk:1;V03:K0:pvQkuuEO2Xs=:qAmBW/bKDpMvBFrlv2UiAt YeHsNC0MrNcGpGixVxh9U3PVK57fbvn0P773oeN8BK9zqsMycZsZFQ9DEhX6CoDMmcB+cfcIk rGXXqA3wHLDHOWkEFXe94agl1sCKf3c/lZ00EEpwRNN1+mO59xzwnLY7qDR/x/7hPRy86KxIT yxWNVARYVDoQ1TKpjEy/aUA6/izt/6ffJHJDYYxXBNlz7zOHDbiUYaJ1KYtjPcrRR8B78S52o oJwws15xr4OQ1sX/GtVYlTe3C6kSmLU+KcLKTV0q6revAqYiXkCaneG7k0p2EW8IY9Ab99smd EB4oJb5cmaqSvU1KLkKLm1TRgIU5aDo+EH//XGQPszd8UBQ/g3xYvUZ07qbHAgIrqBmoQ5rUT tXbRMI1a9g+CU/rhPZadzMaWdRW3qFVfYzFb9yaCbs/1zVcR1k/aww29ZRkuPn1mO8pR1wDds DCI60/pCyn3asMgYu70RkCv0sUelserO27IdRT0iel2JwewTezOTY/sZ8+l+yL4eSoBywSmYG sOSUOVm5ctXml0VlSlm+67HjMvmzR8IpaGrsts4oJeVfqeJKyFnAm9IWK6lOLYyphLZWyZAQo hiEfq2rYgnY2V6NCLKzHBE/L3xJhGVETvfM6laxpm//FBbN8xs7gTOINwPMen4GMVcyIUJqDb 92BWv5HsbseWb6VgWGJcnrX3LmWXIniVqPsIFiAsQonksILG1/cOMMCvTqFEYXIxvodZLdBpO f1FMG02cgrY2lY7HwYwRqjP7E9p6K0wAv3HVSBfPwZMUXZURAXPG13ZFfOY+dnKx26Se0TWE 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:213413 Archived-At: This is a multi-part message in MIME format. --------------BB4D7116E7F8A9E9415B3D4E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > That's orthogonal. (And it seems to issue the warning in an unrelated > case, handled by the 'else' clause?) Which case? > We should first decide how to > support the context menus with this stuff, and then we can talk how to > find code out there which makes similar assumptions. (But if there is > such code out there, how was it working till now?) Maybe I have not been making myself clear. What I would apply is the attached (modulo any errors it contains): No change in behavior, just a warning in the doc-string and suspicious calls. martin --------------BB4D7116E7F8A9E9415B3D4E Content-Type: text/x-patch; name="pos-visible-in-window-p.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pos-visible-in-window-p.diff" diff --git a/src/window.c b/src/window.c index cb8fe5fcdb..a7ad4d5599 100644 =2D-- a/src/window.c +++ b/src/window.c @@ -2172,6 +2172,10 @@ DEFUN ("pos-visible-in-window-p", Fpos_visible_in_w= indow_p, first. POS defaults to point in WINDOW; WINDOW defaults to the selected window. +Do not pass nil as POS unless you are sure that WINDOW displays the +current buffer. This function will emit a warning when POS is neither a +marker, a number or t and WINDOW does not display the current buffer. + If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS])= , where X and Y are the pixel coordinates relative to the top left corner @@ -2199,10 +2203,16 @@ DEFUN ("pos-visible-in-window-p", Fpos_visible_in_= window_p, posint =3D -1; else if (!NILP (pos)) posint =3D fix_position (pos); - else if (w =3D=3D XWINDOW (selected_window)) - posint =3D PT; else - posint =3D marker_position (w->pointm); + { + if (XBUFFER (w->contents) !=3D current_buffer) + message ("`pos-visible-in-window' called with POS nil but WINDOW's buffe= r is not current"); + + if (w =3D=3D XWINDOW (selected_window)) + posint =3D PT; + else + posint =3D marker_position (w->pointm); + } /* If position is above window start or outside buffer boundaries, or if window start is out of range, position is not visible. */ --------------BB4D7116E7F8A9E9415B3D4E--