3

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

  1. I start emacs
  2. Run the command find-file via C-x C-f to open a file
  3. Run the command split-window-below via C-x 2
  4. Run the command other-window via C-x o to switch focus to the new window
  5. Run the command find-file via C-x C-f to open another file
  6. Run the command delete-other-windows via C-x 1 to collapse all other windows and maximise the current one
  7. 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!

3
  • Can you bisect your init file to find the culprit package ("there's clearly a package that's...")?
    – Drew
    Mar 31 at 21:46
  • Yeah @Drew, failing some way to debug it and pinpoint the culprit that may be the only option, but difficult to find time to do :-/
    – ldeck
    Apr 2 at 23:12
  • Bisecting is a binary search: starts out slow, ends up being quick. You can comment parts of your init file (or any files), e.g., 1/2 the file, then 3/4, 7/8, 15/16,..., using M-x comment-region. With a prefix arg it uncomments.
    – Drew
    Apr 3 at 1:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.