Overview
I'm having trouble understanding from my current config why C-x 1
(i.e., M-x delete-other-windows
) does not work when executed from a window in a project that was created as a result of either C-x 2
(i.e., M-x split-window-below
) or C-x 3
(i.e., M-x split-window-right
).
It does work as expected when either running vanilla emacs (emacs -Q -nw
) or when not having navigated to files via project.el
. So there's clearly a package that's introduced a change in behaviour for this in preventing delete-other-windows
from doing just that.
Is it winner-mode
or treemacs
or lsp
or something else?
How do I trace where a no-op is occurring?
Investigations
- I start emacs
- Run the command
find-file
viaC-x C-f
to open a file - Run the command
split-window-below
viaC-x 2
- Run the command
other-window
viaC-x o
to switch focus to the new window - Run the command
find-file
viaC-x C-f
to open another file - Run the command
delete-other-windows
viaC-x 1
to collapse all other windows and maximise the current one - This should leave the the currently focused window and the other file as the only one visible
This works.
If I replace steps 2 and 5 by running the command project-find-file
via C-x p f
(after having switched to a file in a project... e.g., via C-x p p f
) this also works.
If I enable treemacs
and open files from it, it also works.
If I run a scala spec via lsp-metals, using lsp-any-lens to select the relevant lens, it still works.
Summary
At some point (which I'm still trying to figure out) while working within a project, the behaviour changes such that delete-other-windows
stops working if, as stated above, the window that has focus was created as a split.
So it's a bit baffling and I'm not sure how to reproduce it (yet).
Any pointers on being able to turn on tracing or something when it starts to fail would be great.
Even better, knowing how to force the behaviour would be even better. Thanks!
M-x comment-region
. With a prefix arg it uncomments.