Function: ediff-setup-control-buffer
ediff-setup-control-buffer is an autoloaded and byte-compiled function
defined in ediff-util.el.gz.
Signature
(ediff-setup-control-buffer CTL-BUF)
Documentation
Set up window for control buffer CTL-BUF.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; This function assumes that we are in the window where control buffer is
;; to reside.
(defun ediff-setup-control-buffer (ctl-buf)
"Set up window for control buffer CTL-BUF."
(if (window-dedicated-p)
(set-buffer ctl-buf) ; we are in control frame but just in case
(switch-to-buffer ctl-buf))
(let ((window-min-height 2))
(erase-buffer)
(ediff-set-help-message)
(insert ediff-help-message)
;; With the fix for Bug#49277 and an 'ediff-setup-windows-plain'
;; layout, the window of the control buffer we want to adjust here
;; is no longer the lower of two windows on their frame both showing
;; that control buffer but rather the bottom-most window in the
;; established ediff layout for that frame. As a consequence,
;; 'shrink-window-if-larger-than-buffer' will fail to show the whole
;; buffer with 'ediff-toggle-help' because that window's maximum
;; height is not half the height of its frame but the height of the
;; control buffer's window in the established layout (Bug#52504).
;;
;; The form below is an attempt to emulate the behavior of Emacs 27
;; as faithfully as possible in this regard (the use of 'ceiling'
;; mimics the behavior of 'split-window' giving the lower window the
;; residue line when the window to split has an uneven number of
;; lines).
(when (and (window-combined-p)
(pos-visible-in-window-p (point-min)))
(fit-window-to-buffer
nil (ceiling (/ (window-total-height (frame-root-window)) 2.0))))
(or (ediff-multiframe-setup-p)
(ediff-indent-help-message))
(ediff-set-help-overlays)
(set-buffer-modified-p nil)
(ediff-refresh-mode-lines)
(setq ediff-control-window (selected-window))
(setq ediff-window-config-saved
(format "%S%S%S%S%S%S%S%S"
ediff-control-window
ediff-window-A
ediff-window-B
ediff-window-C
ediff-window-Ancestor
ediff-split-window-function
(ediff-multiframe-setup-p)
ediff-wide-display-p))
(set-window-dedicated-p (selected-window) t)
(goto-char (point-min))
(skip-chars-forward ediff-whitespace)))