Open mobid opened 9 months ago
Hmmm I see.
(Context.) Usual Emacs behaviour when splitting is to display the same buffer in the new window. In EXWM we disallow an exwm-mode
buffer to be displayed in more than one window. After splitting the window we notice that two windows display our exwm-mode
buffer so we vacate one of them. I believe that the (selected-window)
gets to keep it. Now, this new window must display another buffer; we go out of our way to prevent this other buffer to be an exwm-mode
buffer being covered: https://github.com/emacs-exwm/exwm/blob/2bb9a5787ea5b15c8fe4e7c461eb99b412363a16/exwm-layout.el#L381-L390
Is there any case when
covered-buffers
are meaningful?
I should know because I implemented this... but didn't write an explanation in https://github.com/ch11ng/exwm/pull/145. Let us... reconstruct a reason.
Please, edit https://github.com/emacs-exwm/exwm/blob/2bb9a5787ea5b15c8fe4e7c461eb99b412363a16/exwm-layout.el#L392 to have instead:
(let ((exwm-layout--other-buffer-exclude-buffers nil))
Now perform the following steps:
Why does XEyes suddenly display in the left window again? I just "moved" it to the middle one!
Shouldn't XEyes move back to the middle window, where I placed it?
I'm pretty sure that's the only reason I had for implementing this covered-buffers
(mis?)feature. That is, although without covered-buffers
our behaviour would be more similar to regular Emacs buffers, it kind of ends up being unintuitive. I think that something similar happens with your proposal above: will showing the prev-buffer on the split window match users' intuition?
(To clarify, I'm opening this for discussion. I'm not sure what's the better behaviour.)
Tangentially, I dislike that we are implementing this at all in EXWM: this should be a Display Buffer Action Function (https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-Display-Action-Functions.html), e.g. display-buffer-unique-window
. I'm not sure whether it is feasible. Also, this behaviour should in my opinion be optional: I believe that I would prefer having exwm-mode
buffers displayed in multiple windows where only the selected one (or last selected) shows the actual X window and the others show, say, a caption or a screenshot (...). I'm also not sure whether this would be comfortable.
It make sense now. Maybe I didn't notice that, because I normally have only few X windows.
I'm fine with the both behaviours, which can be simply acomplished with checking last command in predicate:
(defun exwm-layout--other-buffer-predicate (buffer)
(or (not (with-current-buffer buffer (derived-mode-p 'exwm-mode)))
(and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
(or (not (memq buffer exwm-layout--other-buffer-exclude-buffers))
(eq last-command #'split-window-below)
(eq last-command #'split-window-right))
;; Do not select if already shown in some window.
(not (get-buffer-window buffer t)))))
I understand that same X window cannot be shown in two places, but I rater see previous window instead of previous non-exwm buffer. (when splitting) Same split behaviour has StumpWM.
I believe that I would prefer having exwm-mode buffers displayed in multiple windows where only the selected one (or last selected) shows the actual X window and the others show, say, a caption or a screenshot
I like this idea.
Hi,
If have next case:
As I saw in code https://github.com/emacs-exwm/exwm/blob/master/exwm-layout.el#L392 there is case which prevent my expected behavior. If I set there
covered-buffers
tonil
it is working fine for me.Is there any case when
covered-buffers
are meaningful?