Closed nbarrientos closed 1 year ago
Dear @nbarrientos, thank you very much for this improvement. I detest that it’s taken so long.
I wondered why with-current-buffer
is invoked multiple times in this function. Can’t we wrap it all in with-current-buffer
? I think the answer is “no”: this function makes xcb request/replies, and anything can happen while waiting for the reply. (I’m just thinking out loud).
As I mentioned in https://github.com/ch11ng/exwm/pull/897#issuecomment-1324282700, this error class is pervasive in EXWM. Thank you.
I will adjust the commit message and merge soon.
Merged! This is the first change since December: congratulations! Hopefully we'll cut a release soon.
Thanks for taking a look!
Just released 0.28, featuring this fix. Thank you for improving EXWM!
I've seen that, in some cases, after switching from a non-EXWM buffer to an EXWM one and a mouse click event is triggered,
(current-buffer)
returns still the old buffer whenexwm-input--fake-last-command
(called byexwm-input--on-ButtonPress
) is executed.If I temporary add this debug statement to
exwm-input--fake-last-command
:and, once an ERC channel buffer (
#<buffer #erc>
) is current and displayed in a window, I run:M-x eval-expression (browse-url "http://www.gnu.org") RET
an EXWM buffer containing Firefox takes over the window and, when left-clicking on it,
*XELB-DEBUG*
contains:(note that
current-buffer
is still#<buffer #erc>
, whereas it should be something like#<buffer F# The GNU Operating System and the Free Software Mov... @ www.gnu.org>
.This, apart from being wrong in my opinion, is also problematic if the previous buffer's
post-command-hook
contains statements that require the buffer to be visible in a window, for instance calls torecenter
. If that's the case, EXWM bails out when callingexwm-input--fake-last-command
and ultimately the mouse click event is not processed. Error message:This "synthetic" reproducer is actually the case of ERC buffers where
erc-scrolltobottom-mode
is enabled (erc-scroll-to-bottom
, which eventually callsrecenter
, is added to the buffer'spost-command-hook
).I don't really know why in this scenario
(current-buffer)
does not return the EXWM buffer that's active, but this patch makes sure that the current buffer is the one generating the click event and hence thepost-command-hook
that's executed is the one that's supposed to be (not#<buffer #erc>
's). Once the patch is applied:is written to
*XELB-DEBUG*
when using the reproducer above as expected.