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: Wed, 01 Sep 2021 15:02:04 +0300 Message-ID: <83sfyoqzb7.fsf@gnu.org> References: <87sfys6ubm.fsf@mail.linkov.net> <87eeacdnmg.fsf@gnus.org> <87h7f7z8ui.fsf@mail.linkov.net> <871r6a8ooe.fsf@gnus.org> <87y28i85xi.fsf@mail.linkov.net> <87k0k1o5ks.fsf@mail.linkov.net> <87ilzk6bsr.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13790"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50256@debbugs.gnu.org, larsi@gnus.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 01 14:16:26 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 1mLPAH-0003Jy-8d for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Sep 2021 14:16:25 +0200 Original-Received: from localhost ([::1]:35018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLPAG-0005pO-34 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Sep 2021 08:16:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLOxK-0001Wt-SY for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2021 08:03:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mLOxK-0000v9-JA for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2021 08:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mLOxK-0002AN-4r for bug-gnu-emacs@gnu.org; Wed, 01 Sep 2021 08:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Sep 2021 12:03: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.16304977528265 (code B ref 50256); Wed, 01 Sep 2021 12:03:02 +0000 Original-Received: (at 50256) by debbugs.gnu.org; 1 Sep 2021 12:02:32 +0000 Original-Received: from localhost ([127.0.0.1]:36531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLOwl-000299-Sw for submit@debbugs.gnu.org; Wed, 01 Sep 2021 08:02:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mLOwf-00028m-S7 for 50256@debbugs.gnu.org; Wed, 01 Sep 2021 08:02:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44900) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLOwU-0000Ud-Gj; Wed, 01 Sep 2021 08:02:12 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4557 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 1mLOwS-0001gn-Ez; Wed, 01 Sep 2021 08:02:10 -0400 In-Reply-To: <87ilzk6bsr.fsf@mail.linkov.net> (message from Juri Linkov on Wed, 01 Sep 2021 10:17:56 +0300) 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:213173 Archived-At: > From: Juri Linkov > Date: Wed, 01 Sep 2021 10:17:56 +0300 > Cc: 50256@debbugs.gnu.org > > > So maybe the check for current-buffer above should be added > > to mouse-set-point. > > Now I found the real root of the problems. All reported problems > can be solved by this short patch: > > diff --git a/lisp/subr.el b/lisp/subr.el > index 0a31ef2b29..0b3b8d0e0f 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -1510,8 +1510,8 @@ event-start > > For more information, see Info node `(elisp)Click Events'." > (if (consp event) (nth 1 event) > - (or (posn-at-point) > - (list (selected-window) (point) '(0 . 0) 0)))) > + (or (posn-at-point (window-point)) > + (list (selected-window) (window-point) '(0 . 0) 0)))) I don't understand this: are you saying that in a selected window you see point different from window-point? How does that happen? > Both 'event-start' and 'event-end' created an event > with the window equal to the selected window, > but point from some random buffer, > not from selected window's buffer. Can you show the recipe that produces this strange result? (I looked at bug#9923, which you say is where this was reported, but couldn't find a recipe there for which you described the sequence of calls.) > One question still remains: maybe this fix should be implemented > at a deeper level in posn-at-point when its arg POS is nil? > > But actually, posn-at-point just uses this line: > > tem = Fpos_visible_in_window_p (pos, window, Qt); > > So maybe this fix should be implemented in Fpos_visible_in_window_p, > i.e. at the end of this code > > if (EQ (pos, Qt)) > posint = -1; > else if (!NILP (pos)) > posint = fix_position (pos); > else if (w == XWINDOW (selected_window)) > posint = PT; > else > posint = marker_position (w->pointm); > > it should get position from the selected window's buffer? Once again, in a selected window, point (a.k.a. "PT" in C) should be identical to the window-point of that window. So I don't think I understand why this would need any change. Please tell more.