treemacs icon indicating copy to clipboard operation
treemacs copied to clipboard

Prefer `display-buffer' to home-grown window management

Open mickeynp opened this issue 1 year ago • 0 comments

This PR replaces internal calls made directly to both switch-to-buffer, display-buffer-in-side-window, et al. with the preferred method of window management in newer Emacsen.

Instead of setting window dedication, window size, and side bar position directly, the code defers this to display-buffer with a suitable ACTION strategy.

Now a user can override how Treemacs displays its main window by configuring display-buffer-alist:

("^ \\*Treemacs" display-buffer-in-side-window
  (side . right)
  (window-width . 30))

Note that although I've tested it, I am not familiar with the complications of the code writ large, so it's possible there are some feature regressions. But it works well, and this is guaranteed to place nice with all and sundry that use display-buffer-alist.

mickeynp avatar Aug 24 '22 09:08 mickeynp