Subject: Re: bug#50256: thing-at-mouse

From: Juri Linkov <[email-masked]>
Date: Wed, 01 Sep 2021 19:25:15 +0300

>>   (with-current-buffer "*Messages*"
>>     (mouse-set-point last-input-event))
>>
>> and it moves point in *scratch* to the position of point of
>> the *Messages* buffer.
>
> I don't follow: what do you expect to be in last-input-event in this
> case, and how is that relevant to mouse clicks, when the mouse is not
> even involved in this scenario?

Normally, last-input-event should be a mouse click event.
But sometimes it gets a non-mouse event (e.g. a number).
Then in mouse-set-point, event-end produces a fake mouse event
using posn-at-point.  But such constructed event
contains position from a random buffer (that was current
at the time of invocation). It should contain the position
of point in the buffer displayed in the selected window.