Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ement-room-list should not call display-buffer when reverting (display-buffer-alist may conflict when customized) #121

Closed
mekeor opened this issue Jan 15, 2023 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mekeor
Copy link

mekeor commented Jan 15, 2023

When I evaluate

  (add-to-list 'display-buffer-alist
    '(always (display-buffer-reuse-window display-buffer-same-window)))

then the *Ement Room List* buffer is frequently, disturbingly reopened all the time. Is this expected behaviour? I don't think so.

@alphapapa
Copy link
Owner

alphapapa commented Jan 20, 2023

Hello,

The code in question appears to be here:

ement.el/ement-room-list.el

Lines 629 to 632 in 28de42d

(defun ement-room-list-revert (_ignore-auto _noconfirm)
"Revert current Ement-Room-List buffer."
(interactive)
(ement-room-list :display-buffer-action '(display-buffer-no-window (allow-no-window . t))))
I guess you're overriding the alist there, '(display-buffer-no-window (allow-no-window . t)), which causes the window to be redisplayed when the room list buffer is refreshed, which happens each time an update is received from the Matrix server.

The easiest solution would probably be for you to adjust your display-buffer-alist to not affect the *Ement Room List* buffer. Alternatively, some of the code in question could be refactored to not call display-buffer. Or maybe the ement-room-list function could be modified to not call display-buffer when its :display-buffer-alist argument is nil.

What do you think? Thanks.

@mekeor
Copy link
Author

mekeor commented Feb 5, 2023 via email

@alphapapa
Copy link
Owner

From the perspective of an Ement-user, it'd be nicer if Ement would not call display-buffer in the first place. What's even the reason it does call it? I mean, the buffer is not meant to be displayed in this situation, right? Without understanding the code, it seems, Ement is hijacking the display-buffer stuff for another purpose.

It's an implementation detail: the command to show the room list buffer shows the buffer, of course. The command to refresh that buffer calls the same command again, but it does so with an argument that causes display-buffer to not actually display the buffer. That works as intended, unless the user customizes display-buffer-alist to override that behavior, as you did.

Of course, there's nothing wrong with your doing that, so, yes, probably the command should not call display-buffer at all when refreshing the buffer. It will take a few lines of code, but it will be more correct.

I'll intend to make this fix in v0.6. Thanks for reporting it.

@alphapapa alphapapa self-assigned this Feb 7, 2023
@alphapapa alphapapa added the bug Something isn't working label Feb 7, 2023
@alphapapa alphapapa added this to the 0.6 milestone Feb 7, 2023
@alphapapa alphapapa changed the title Bad interaction with display-buffer-alist? ement-room-list should not call display-buffer when reverting (display-buffer-alist may conflict when customized) Feb 7, 2023
@mekeor
Copy link
Author

mekeor commented Feb 8, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants