ediff

Below are my customisations for ediff, explanations are captured in follow on sections

init.el
(use-package alc-ediff
  :load-path "lisp"
  :custom
  ((ediff-window-setup-function 'alc-ediff-window-setup-function))
  :config
  ;; I tried setting these via `:hook` but they seemed to be clobbered by ediff's setup code...
  (add-hook 'ediff-suspend-hook #'alc-ediff-suspend-hook)
  (add-hook 'ediff-quit-hook #'alc-ediff-quit-hook))

Window Management

ediff runs an arbitrary function ediff-window-setup-function to configure the window layout at the start of an ediff session. I’m quite happy with ediff-setup-windows-plain, the only tweak I want to make is to have the window layout open in a new tab.

lisp/alc-ediff.el
(require 'ediff)

(defun alc-ediff-window-setup-function (&rest args)
  "Configure the window layout for an ediff session."
  (tab-new)
  (apply #'ediff-setup-windows-plain args))

Of course, the newly created tab should be closed on session quit/suspend.

lisp/alc-ediff.el
(defun alc-ediff-suspend-hook ()
  "Close the tab created by `alc-ediff-window-setup-function'."
  (tab-close))

(defun alc-ediff-quit-hook ()
  "Close the tab created by `alc-ediff-window-setup-function'."
  (tab-close))