-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treemacs unwanted resizing #376
Comments
Isn't there a hook when a window is resized? We could use that instead. |
Reopening on account of #41 |
Does this help: (with-eval-after-load 'which-key
(defun treemacs--fix-width-after-which-key (func &rest args)
"Advice to sure treemacs' window size stays put when which-key is active.
Wraps original FUNC + ARGS."
(let* ((window (treemacs-get-local-window))
(should-toggle (when window
(not (buffer-local-value 'treemacs--width-is-locked
(window-buffer window))))))
(when should-toggle
(with-selected-window window
(treemacs-toggle-fixed-width)))
(apply func args)
(when should-toggle
(with-selected-window window
(treemacs-toggle-fixed-width)))))
(advice-add 'which-key--update :around 'treemacs--fix-width-after-which-key)
(advice-add 'which-key--hide-popup :around 'treemacs--fix-width-after-which-key)) |
Nope. When unlocking fixed-width and trying to drag the window border, I get:
This is on Please let me know what kind of additional info I can provide. |
Weird stuff. My advice for which-key's functions calls them with the very same arguments they'd be called with anyway. Let's try again. My guess is that the previously defined advice was interfering, so we'll remove that first. (with-eval-after-load 'which-key
(advice-remove 'which-key--update 'treemacs--fix-width-after-which-key)
(advice-remove 'which-key--hide-buffer-side-window 'treemacs--fix-width-after-which-key)
(defun treemacs--fix-width-after-which-key (func &rest args)
"Advice to sure treemacs' window size stays put when which-key is active.
Wraps original FUNC + ARGS."
(let* ((window (treemacs-get-local-window))
(should-toggle (and (with-no-warnings (which-key--popup-showing-p))
(when window
(not (buffer-local-value 'treemacs--width-is-locked
(window-buffer window))))))
(treemacs--no-messages t))
(when should-toggle
(with-selected-window window
(treemacs-toggle-fixed-width)))
(apply func args)
(when should-toggle
(with-selected-window window
(treemacs-toggle-fixed-width))))
(advice-add 'which-key--update :around 'treemacs--fix-width-after-which-key)
(advice-add 'which-key--hide-buffer-side-window :around 'treemacs--fix-width-after-which-key))) |
No error anymore, but no resize either:
Are you able to repro with my config: https://github.com/bk138/dotfiles/blob/master/.emacs ? Update: Your snippet does fix interaction with which-key. I have another package 'dashboard' (https://github.com/emacs-dashboard/emacs-dashboard) which seems to forbid window resizing as well. Shall I open an issue with treemacs or with them? |
All I'm getting up to is setting a single variable that determines whether the width of the treemacs window should be fixed or not. If dashboard.el interferes with that then I think it's on them to look into this. |
On Aquamacs this bug with treemacs getting larger with which-key seems to have come back after the 20190814.459 elpa version now on 20191106.2038 I don't remeber seeing this size increase before |
Let's have a look. What do your which-key and treemacs settings look like? |
The wonders of HTML cut and past of elisp here removes all < and > to the viewer but they are visible in the edit
|
One thing that tripped me up when trying out treemacs for the first time is that it still honors The workaround is to use |
Hmm, I had integrated the which-key glue code a long time ago, but forgot about this ticket. And based on #674 the resizing no longer even happens. I think we can safely close this. @fjl Why shouldn't it honor |
I added this comment because my |
Treemacs automatically increases the width of its own window after a which key popup. My which-key popup is shown on the right side.
The text was updated successfully, but these errors were encountered: