This is what I was doing before Magit 2.3, adapted from What the .emacs.d!?:
(defadvice magit-status (around magit-fullscreen activate)
"Turn fullscreen on for magit-status."
(defun magit-quit-session ()
"Restore previous window configuration and cleanup buffers."
(bind-key "q" #'magit-quit-session magit-status-mode-map)
(defun mu-kill-buffers (regexp)
"Kill buffers matching REGEXP without asking for confirmation."
(interactive "sKill buffers matching this regular expression: ")
(cl-letf (((symbol-function 'kill-buffer-ask)
(lambda (buffer) (kill-buffer buffer))))
The difference from the solution on What the .emacs.d!? is that I like
q to close all Magit buffers and not only
If you don't have
bind-key, you can just use regular
(define-key magit-status-mode-map (kbd "q") #'magit-quit-session)
Following the new Magit guidelines, this is the solution that is now working for me:
(when (derived-mode-p 'magit-status-mode)