emacs-lsp / lsp-treemacs

lsp-mode :heart: treemacs
GNU General Public License v3.0
396 stars 46 forks source link

Cannot delete the main window #122

Open Horrih opened 2 years ago

Horrih commented 2 years ago

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.

1) emacs -nw main.cpp 2) M-x lsp-treemacs-errors-list 3) M-x other-window ;; Switch back to main.cpp 4) M-x split-window-right ;; Open a new window on the right on main.cpp 5) M-x other-window ;; Switch to the right window 6) 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.

skat-kurt commented 1 year ago

Confirmed on emacs 28.2 with treemacs v3.0 (installed 2023.03.18).

noorul commented 1 year ago

Any work around for this?

Horrih commented 1 year ago

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))

jasalt commented 4 months ago

Affects 29.1 still. @Horrih workaround is seems like best solution for now.

Two possibly related unanswered Emacs StackOverflow threads: