lsp-treemacs
lsp-treemacs copied to clipboard
Cannot delete the main window
Hello, I have noticed an issue with closing windows after calling lsp-treemacs-errors-list : i cannot close the main window anymore from a secondary window.
To reproduce : emacs 27.1, a pretty standard init.el with treemacs, lsp, lsp-treemacs used on a cpp file with clangd as backend. Dunno if it's important but I have not enabled the treemacs view on the left on startup.
- emacs -nw main.cpp
- M-x lsp-treemacs-errors-list
- M-x other-window ;; Switch back to main.cpp
- M-x split-window-right ;; Open a new window on the right on main.cpp
- M-x other-window ;; Switch to the right window
- M-x delete-other-windows ;; Try to delete the left window : does not work
Step 6 closes the treemacs window but not the left window. If I run delete-other-windows from the left window , the right window gets closed correctly though
After some investigation, this is due to a dangling no-delete-other-windows parameter that seems set to the wrong window. I had a quick look to the source code but you don't seem to set the flag directly. I currently don't have the bandwidth to investigate more and submit a PR, but maybe in a few weeks if you don't have time on your side.
Confirmed on emacs 28.2 with treemacs v3.0 (installed 2023.03.18).
Any work around for this?
Any work around for this?
I added this to my config, but it will also affect other treemacs instances so not a great work around
(use-package treemacs :custom (treemacs-no-delete-other-windows nil))
Affects 29.1 still. @Horrih workaround is seems like best solution for now.
Two possibly related unanswered Emacs StackOverflow threads:
- https://emacs.stackexchange.com/questions/76595/help-delete-other-windows-only-working-from-the-original-window
- https://emacs.stackexchange.com/questions/77201/lsp-modes-magic-to-prevent-c-x-1-from-working