When I moved back to my own Emacs configuration from Spacemacs one thing that I missed most was to have Magit’s status window cover the whole frame.
Since Magit 2.8 from August 2016 that’s quite simple. It now ships
pre-made variants for the
magit-display-buffer-function option, one of those
magit-display-buffer-fullframe-status-v1 which displays the status
buffer over the whole frame. Using it is as easy as:
(setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
But how would you reproduce this behaviour in older versions of Magit?
Turns out that for Emacs 24 and newer the solution is just one entry in
(add-to-list 'display-buffer-alist `(,(rx "*magit: ") (lunaryorn-display-buffer-fullframe) (reusable-frames . nil)))
There’s no built-in display function to show a window over the whole frame but it’s simple to write one:
(defun lunaryorn-display-buffer-fullframe (buffer alist) "Display BUFFER in fullscreen. ALIST is a `display-buffer' ALIST. Return the new window for BUFFER." (let ((window (display-buffer-pop-up-window buffer alist))) (when window (delete-other-windows window)) window))
We simply need to get hold of any arbitrary window for the
buffer, and then
just delete all other windows, leaving only the window for our
I’m using the “official” variant from Magit these days, of course, but
display-buffer-alist serves as a nice remainder of the powerful
customisation options modern Emacs offers.