Function: treemacs--split-window-advice

treemacs--split-window-advice is a byte-compiled function defined in treemacs-compatibility.el.

Signature

(treemacs--split-window-advice ORIGINAL-SPLIT-FUNCTION &rest ARGS)

Documentation

Advice to make sure window splits are sized correctly with treemacs.

This will treat the treemacs window as a side-window for the duration of the split, calling the ORIGINAL-SPLIT-FUNCTION with its ARGS. This prevents the calculations in split-window-right from outputting the wrong result for the width of the new window when the treemacs window is visible.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-compatibility.el
(defun treemacs--split-window-advice (original-split-function &rest args)
  "Advice to make sure window splits are sized correctly with treemacs.
This will treat the treemacs window as a side-window for the duration of the
split, calling the ORIGINAL-SPLIT-FUNCTION with its ARGS.  This prevents the
calculations in `split-window-right' from outputting the wrong result for the
width of the new window when the treemacs window is visible."
  (-let [w (treemacs-get-local-window)]
    (unwind-protect
        (progn
          (when w (set-window-parameter w 'window-side treemacs-position))
          (apply original-split-function args))
      (when (and w (null treemacs-display-in-side-window))
        (set-window-parameter w 'window-side nil)))))