1

When I use Spacemacs with the Treemacs feature inside it, like the picture, I opened it by Alt Shift m + p + t enter image description here

Then use Ctrl x + u to open undo-tree enter image description here

When I move the cursor on the undo-tree by Ctrl + p, the layout had been resized enter image description here

Even I close the undo-tree window, the layout didn't back to the first picture. enter image description here

Why it happened? How to avoid it?

madaha
  • 11
  • 1
  • I am familiar with `undo-tree` and am unaware of any code that resizes windows. It only uses `switch-to-buffer-other-window`, `switch-to-buffer` and `display-buffer`. The culprit may possibly lie elsewhere. – lawlist Apr 20 '22 at 02:21
  • @lawlist Thank you. I just installed Spacemacs v.0.300.0 . I didn't set any addon configuration after install it. This issue happened on both Linux and macOS. – madaha Apr 20 '22 at 02:41
  • I am not familiar with `treemacs`, but did a quick git clone and grep for `shrink` and `enlarge` and came up with the function `treemacs--set-width`. In your debugging quest, consider copying `treemacs--set-width` to a `*scratch*` buffer and modify it by making it do nothing. e.g., comment out everything and then evaluate the modified function; e.g., the new function that could be evaluated looks like `(defun treemacs--set-width (width) "Doc-string." nil)` You could even just type `M-x eval-expression RET (defun treemacs--set-width (width) "Doc-string." nil) RET`; and, then repeat your test. – lawlist Apr 20 '22 at 02:56
  • @lawlist Thank you for your advice. Maybe there are something config conflict by default. – madaha Apr 20 '22 at 03:22
  • If something is resizing windows, then the functions that have `shrink` and `enlarge` in their names are most likely responsible (with a few unlikely exceptions, e.g., where an `alist` to a `display-buffer` family of functions is expressly set with a particular width). Once you track down the function responsible, then you can work your way backwards to where the function is called, and then devise a plan to deal with the situation. You could even just put in some messages in the function mentioned in my previous comment to see when it gets called ... – lawlist Apr 20 '22 at 03:24
  • In my own setup, I modified `undo-tree-visualize-undo` and `undo-tree-visualize-redo` to use `with-current-buffer` instead of `switch-to-buffer-other-window`, and that bypasses the problem with resizing window functions bound to the `window-configuration-change-hook` such as what is probably happening in your situation. Here is a gist from a couple of years ago -- It would be necessary to compare the code to the current version of `undo-tree.el` to ensure everything else is still the same. https://gist.github.com/lawlist/4765516cf58a1ccc1d11de63bacaff34 – lawlist Apr 20 '22 at 03:53
  • Putting a dot here, facing the same issue in spacemacs – Edwin Clement May 12 '22 at 19:02

0 Answers0