I'd like magit to default to a large buffer instead of one that is half the size of the available space. Even better would be a way to wrap the call to a major mode to make this happen when opening any major mode?
Not sure about applying this in general but magit has a configuration variable for this,
magit-status-buffer-switch-function. By default it is set to
pop-to-buffer which prefers to open an alternate buffer, ie
other-window or split screen and
other-window. However, if you customize the value to
switch-to-buffer it will swap out the current buffer for
magit-status. Throw the following in your init file and it should open it in the current window:
(setq magit-status-buffer-switch-function 'switch-to-buffer)
How about fullframe ?
From their docs:
;;; Open magit-status in a single window in fullscreen (require 'fullframe) (fullframe magit-status magit-mode-quit-window nil)
Here are some examples using fullframe, lifted straight from my emacs config:
(eval-after-load 'package '(fullframe list-packages quit-window)) (eval-after-load 'magit '(fullframe magit-status magit-mode-quit-window)) (eval-after-load 'ibuffer '(fullframe ibuffer ibuffer-quit))
The first parameter for
fullframe is any command which creates and switches to a new window, and the second is a function which is called when that window is quit - either the command the user uses to quit the window, or a command which is called in the course of the window being quit.
Specifically with regards to Magit and
magit-status, the following should do the trick for you: Magit Status Fullscreen from Magnar Sveen's What the .emacs.d!? blog.
;; full screen magit-status (defadvice magit-status (around magit-fullscreen activate) (window-configuration-to-register :magit-fullscreen) ad-do-it (delete-other-windows)) ;; restore previously hidden windows (defadvice magit-quit-window (around magit-restore-screen activate) ad-do-it (jump-to-register :magit-fullscreen))
Updated with Brad Wright's comment with regards to restoring previous view.
This is the solution I currently use.
(defadvice magit-status (around magit-fullscreen activate) (window-configuration-to-register :magit-fullscreen) ad-do-it (delete-other-windows)) (defun custom-kill-buffers (regexp) "Kill buffers matching REGEXP without asking for confirmation." (interactive "sKill buffers matching this regular expression: ") (flet ((kill-buffer-ask (buffer) (kill-buffer buffer))) (kill-matching-buffers regexp))) (defun magit-quit-session () "Restores the previous window configuration and kills the magit buffer" (interactive) (custom-kill-buffers "^\\*magit") (jump-to-register :magit-fullscreen)) (define-key magit-status-mode-map (kbd "q") 'magit-quit-session)
I customized the solution explained on whattheemacsd.com: I close every magit buffer when I press "q".