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: Mon, 6 Sep 2021 10:31:01 +0200 Message-ID: <85beb5ec-ee4c-5308-503e-7664828b3e45@gmx.at> References: <87sfys6ubm.fsf@mail.linkov.net> <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> <087851c3-b3b1-5130-f4b1-50cd42ef83a8@gmx.at> <83ilzgwp2w.fsf@gnu.org> <361bb63a-5e29-9785-0785-6c46f6621223@gmx.at> <831r63v0hb.fsf@gnu.org> <83tuiztl39.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15321"; 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 Mon Sep 06 10:32:38 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 1mNA3R-0003r3-J3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Sep 2021 10:32:37 +0200 Original-Received: from localhost ([::1]:60836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNA3Q-0008Ua-DG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Sep 2021 04:32:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNA2s-0008Sn-R2 for bug-gnu-emacs@gnu.org; Mon, 06 Sep 2021 04:32:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40148) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNA2s-00031R-Hp for bug-gnu-emacs@gnu.org; Mon, 06 Sep 2021 04:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mNA2s-0002pQ-F3 for bug-gnu-emacs@gnu.org; Mon, 06 Sep 2021 04:32: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: Mon, 06 Sep 2021 08:32: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.163091707310791 (code B ref 50256); Mon, 06 Sep 2021 08:32:02 +0000 Original-Received: (at 50256) by debbugs.gnu.org; 6 Sep 2021 08:31:13 +0000 Original-Received: from localhost ([127.0.0.1]:51691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNA24-0002nz-Vi for submit@debbugs.gnu.org; Mon, 06 Sep 2021 04:31:13 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:42183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNA21-0002ni-Qe for 50256@debbugs.gnu.org; Mon, 06 Sep 2021 04:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630917063; bh=Wc9blmdg/0yKpc6TiXWKW5zoYZpx/BW++kItcT/mzks=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=VRm5M3nw+N9f+MaSFhFYVQq+omOeOlvxy/eoc1+G27lseYeWXlKaYa35qQIzEEdTf s15WvOcG25UZ+JISjww7a25umrIFnbq14vFg3Kf4HKF9HdIGOUsT/3FS3/K6caRU+M l3Y8kUi0PgLwb9dgXB372amzx/Z9LmImsYthLj0o= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([213.142.97.9]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N17UW-1n7kJZ1yGY-012cFd; Mon, 06 Sep 2021 10:31:03 +0200 In-Reply-To: <83tuiztl39.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:M/EqVajYAMdb6QrN7uRsIR6qYMhAJZolISAX5OJgzuM1qX0Dy4X 2k3ETlkuAYd9UK6CW9QnqrSa9mTtfrXkuGwnklvomZhYep3w6ik+hl8YVGuc3QVdnnTk339 nDTM5KWC01qYL9iKx5A/RQZtCep2PUot3R+DBfuujI+sKxNmz/dQDt7vQdRlsHefP3gK+w+ /DHWJ1NR0Z866dWddJUHQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:4cNyUsf7NDY=:5Fb/IRFtVWfoMSig7nBFGA 7ogi8W4bJrmiacT85vxwMhw91jO2aNWK30W8CTnj5U3RSg9wl+k6ZV7BAdfg2iTA0TWrFrDoI 60tlUopUZxuxDJrIbrDPY0+1ZoEW6DnXvn300R64GdnLnIzXs18kWre5N3SNQo2LeiPiTx2us letqCDCA4FXh1wFndmAelWYWb/CWc9jIJR+VthxUGrwyBJWNGkhvH4a4AZJqp4VZ3aD2LgbRa o5Es7ZlfYYplGwJ2zmImmr2KiuMbPrx9HnSCvRvP2xyGEoEkZkIaJHcJ2BI5RK2F9+wm+bl51 JZbXnMbiOJo8758D54DjFff3sGLi1JwOIZXomPl+jVWqXraKDSUYqcIOefPhrY2iFs8L/PkTf hNahw7bSEkW4JEw5Jiha9w1+j87X88ZyBP2rjgqz6ABquhkCu2+1FeWoYypuueB6cP3QoqKHL VsK3OVQQ2k311uDtM9DNAsEKrkIUqqqiDaStXeQz8eH+DPgBDGNraacu8Eeb5EwIZyhQNBXrz HfR7TvQlcrCfeVz0T1RY0tyFQsL4SFv3AFMVhSCZQ/LWYaCaZNcSMrviT3ViR0sGc3BN5JssO D32zTTUEBGDVbzfEQs/ZxwfCjMlffRC0h6Qg0TKXojuSDd4eMlBUoww1Iq49aOlLP59aJ/nC7 6Rfvb6UyIa2GTyGLk/8/9TwmrICn2Jn4Ube1C/zuq1uxRM/uy8NQRMe+uHa89N+bmyB5/X1l/ R7pokyh8+6OTEP0iCCmG++xXYEFsohPi2+238TtVLAgQHB3dFkZDmKHGi7lRufSxbsGfLaSC 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:213559 Archived-At: > The actual issue is that pos-visible-in-window-p and posn-at-point > produced unexpected results when the buffer shown in the selected > window was momentarily changed by with-current-buffer. Whatever `with-current-buffer' does, it does not "momentarily change the buffer shown in the selected window". I've re-read this thread and now think too that we should not change the code of neither `posn-at-point' nor `pos-visible-in-window-p'. Given that a function that calls any of these can have used `with-current-buffer', `set-window-point' and `goto-char', it's easy to see that when passing nil as POS argument DTRT never works out. Suppose I have two windows, the selected one showing *scratch*, the other one showing *Messages*, and I managed to make position 0 in the *Messages* window vertically scrolled out of view. If I now do (let ((window (next-window))) (set-window-point window 0) (pos-visible-in-window-p nil window)) I get nil as response although in the resulting configuration position 0 is clearly visible. If OTOH I do (with-current-buffer (window-buffer (next-window)) (goto-char 0) (pos-visible-in-window-p nil (next-window))) I get t although in the resulting configuration position 0 is clearly out of view. We may call both pilot errors but I see no evidence that the coder did anything wrong wrt our docs of `pos-visible-in-window-p'. If I do instead (let ((window (next-window))) (set-window-point window 0) (pos-visible-in-window-p (window-point) window)) and (with-current-buffer (window-buffer (next-window)) (goto-char 0) (pos-visible-in-window-p (point) (next-window))) I get the results I would have expected. So I would, in general, recommend against using nil as POS argument for `pos-visible-in-window-p'. Given how fairly rare in our code base the use of nil is, such recommendation seems feasible to me. For Emacs 29 it should be then even possible to warn whenever it's used. martin