Skip to main content
deleted 3 characters in body
Source Link

The issue is caused by the function undo-tree-visualizer-update-diff, which contains a (balance-windows) command at the end. So the simple dirty trick is to re-define the function with that command commented out after loading undo-tree:

(with-eval-after-load 'undo-tree

  ;; [2023-10-20 Fri] modify this function from undo-tree.el to prevent
  ;; re-balancing windows ------------------------------------------------------
  (defun undo-tree-visualizer-update-diff (&optional node)
    ;; update visualizer diff display to show diff between current state and
    ;; NODE (or previous state, if NODE is null)
    (with-current-buffer undo-tree-visualizer-parent-buffer
      (undo-tree-diff node))
    (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
      (when win
        ;; (balance-windows); comment this line out 
        (shrink-window-if-larger-than-buffer win))))
  )
)

The issue is caused by the function undo-tree-visualizer-update-diff, which contains a (balance-windows) command at the end. So the simple dirty trick is to re-define the function with that command commented out after loading undo-tree:

(with-eval-after-load 'undo-tree

  ;; [2023-10-20 Fri] modify this function from undo-tree.el to prevent
  ;; re-balancing windows ------------------------------------------------------
  (defun undo-tree-visualizer-update-diff (&optional node)
    ;; update visualizer diff display to show diff between current state and
    ;; NODE (or previous state, if NODE is null)
    (with-current-buffer undo-tree-visualizer-parent-buffer
      (undo-tree-diff node))
    (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
      (when win
        ;; (balance-windows); comment this line out 
        (shrink-window-if-larger-than-buffer win))))
  )
)

The issue is caused by the function undo-tree-visualizer-update-diff, which contains a (balance-windows) command at the end. So the simple dirty trick is to re-define the function with that command commented out after loading undo-tree:

(with-eval-after-load 'undo-tree

  ;; [2023-10-20 Fri] modify this function from undo-tree.el to prevent
  ;; re-balancing windows ------------------------------------------------------
  (defun undo-tree-visualizer-update-diff (&optional node)
    ;; update visualizer diff display to show diff between current state and
    ;; NODE (or previous state, if NODE is null)
    (with-current-buffer undo-tree-visualizer-parent-buffer
      (undo-tree-diff node))
    (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
      (when win
        ;; (balance-windows); comment this line out 
        (shrink-window-if-larger-than-buffer win))))
  )
Source Link

The issue is caused by the function undo-tree-visualizer-update-diff, which contains a (balance-windows) command at the end. So the simple dirty trick is to re-define the function with that command commented out after loading undo-tree:

(with-eval-after-load 'undo-tree

  ;; [2023-10-20 Fri] modify this function from undo-tree.el to prevent
  ;; re-balancing windows ------------------------------------------------------
  (defun undo-tree-visualizer-update-diff (&optional node)
    ;; update visualizer diff display to show diff between current state and
    ;; NODE (or previous state, if NODE is null)
    (with-current-buffer undo-tree-visualizer-parent-buffer
      (undo-tree-diff node))
    (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
      (when win
        ;; (balance-windows); comment this line out 
        (shrink-window-if-larger-than-buffer win))))
  )
)