tools/magit: use current window instead of fullcol

Full column is a bit tempermental. This also removes the need to restore
the window config after quitting magit.

Why the switch from full-frame magit to current-buffer? It is the least
intrusive policy; it doesn't rearrange the user's workspace.
This commit is contained in:
Henrik Lissner 2018-08-19 01:13:45 +02:00
parent 6d1db77fae
commit 9e0e586dd8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -21,16 +21,17 @@
(derived-mode-p 'magit-mode)) (derived-mode-p 'magit-mode))
(let ((size (cond ((eq buffer-mode 'magit-process-mode) 0.35) (let ((size (cond ((eq buffer-mode 'magit-process-mode) 0.35)
((bound-and-true-p git-commit-mode) 0.7) ((bound-and-true-p git-commit-mode) 0.7)
(t 0.9)))) (0.9))))
`(display-buffer-below-selected . ((window-height . ,size))))) `(display-buffer-below-selected
. ((window-height . ,(truncate (* (window-height) size)))))))
;; log/stash/process buffers, unless opened from a magit-status ;; log/stash/process buffers, unless opened from a magit-status
;; window, should be opened in popups. ;; window, should be opened in popups.
((memq buffer-mode '(magit-process-mode ((memq buffer-mode '(magit-process-mode
magit-log-mode magit-log-mode
magit-stash-mode)) magit-stash-mode))
'(display-buffer-in-side-window)) '(display-buffer-below-selected))
;; Last resort: plain old fullcolumn. ;; Last resort: use current window
('(magit--display-buffer-fullcolumn)))))) ('(display-buffer-same-window))))))
;;;###autoload ;;;###autoload
(defun +magit-display-popup-buffer (buffer &optional alist) (defun +magit-display-popup-buffer (buffer &optional alist)
@ -52,9 +53,7 @@
(defun +magit/quit (&optional _kill-buffer) (defun +magit/quit (&optional _kill-buffer)
"Clean up magit buffers after quitting `magit-status'." "Clean up magit buffers after quitting `magit-status'."
(interactive) (interactive)
(let ((buffers (magit-mode-get-buffers))) (mapc #'+magit--kill-buffer (magit-mode-get-buffers)))
(magit-restore-window-configuration)
(mapc #'+magit--kill-buffer buffers)))
(defun +magit--kill-buffer (buf) (defun +magit--kill-buffer (buf)
"TODO" "TODO"