Improve magit display-buffer logic

Now opens derivative magit buffers (from popup magit windows) in
fullscreen.
This commit is contained in:
Henrik Lissner 2018-06-16 14:38:52 +02:00
parent 709c708376
commit c305d63dd7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -8,27 +8,41 @@
popups. popups.
2. The status screen isn't buried when viewing diffs or logs from the status 2. The status screen isn't buried when viewing diffs or logs from the status
screen." screen."
(display-buffer (let ((buffer-mode (buffer-local-value 'major-mode buffer)))
buffer (cond ((or (bound-and-true-p git-commit-mode) (display-buffer
(derived-mode-p 'magit-log-mode)) buffer (cond
'(display-buffer-below-selected)) ;; If opened from a magit window from a popup, open the results
((derived-mode-p 'magit-mode) ;; full screen. We want to see it all.
(when (eq major-mode 'magit-status-mode) ((eq (window-dedicated-p) 'side)
(display-buffer-in-side-window '(magit--display-buffer-fullframe))
(current-buffer) '((side . left) ;; From a commit or magit-log buffer, open detail buffers below
(window-width . 0.35) ;; this one.
(window-parameters (quit))))) ((or (bound-and-true-p git-commit-mode)
'(display-buffer-same-window)) (derived-mode-p 'magit-log-mode))
((buffer-local-value 'git-commit-mode buffer) '(display-buffer-below-selected))
'(magit--display-buffer-fullframe)) ;; From a magit buffer, set aside the magit-status window if it
((memq (buffer-local-value 'major-mode buffer) ;; exists (we want it always to be visible), then display the
'(magit-process-mode ;; target buffer in the current window.
magit-revision-mode ((derived-mode-p 'magit-mode)
magit-log-mode (when (eq major-mode 'magit-status-mode)
magit-diff-mode (display-buffer-in-side-window
magit-stash-mode)) (current-buffer) '((side . left)
'(display-buffer-in-side-window)) (window-width . 0.35)
('(magit--display-buffer-fullframe))))) (window-parameters (quit)))))
'(display-buffer-same-window))
;; If the target buffer opening is a commit, revision or diff, we
;; want to see the whole thing.
((or (buffer-local-value 'git-commit-mode buffer)
(memq buffer-mode '(magit-revision-mode magit-diff-mode)))
'(magit--display-buffer-fullframe))
;; log/stash/process buffers, unless opened from a magit-status
;; window, should be opened in popups.
((memq buffer-mode '(magit-process-mode
magit-log-mode
magit-stash-mode))
'(display-buffer-in-side-window))
;; Last resort: plain old fullscreen.
('(magit--display-buffer-fullframe))))))
;; ;;