Fix #3726: respect +magit-open-windows-in-direction
Also fixes an issue where `q` would not delete a magit-dedicated split window (leaving duplicate magit-status windows about).
This commit is contained in:
parent
050ac73789
commit
95c5ebc01a
2 changed files with 19 additions and 10 deletions
|
@ -63,18 +63,26 @@
|
||||||
This differs from `display-buffer-in-direction' in one way: it will try to use a
|
This differs from `display-buffer-in-direction' in one way: it will try to use a
|
||||||
window that already exists in that direction. It will split otherwise."
|
window that already exists in that direction. It will split otherwise."
|
||||||
(let ((direction (or (alist-get 'direction alist)
|
(let ((direction (or (alist-get 'direction alist)
|
||||||
+magit-open-windows-in-direction)))
|
+magit-open-windows-in-direction))
|
||||||
|
(origin-window (selected-window)))
|
||||||
(if-let (window (window-in-direction direction))
|
(if-let (window (window-in-direction direction))
|
||||||
(select-window window)
|
(select-window window)
|
||||||
(if-let (window (window-in-direction
|
(if-let (window (and (not (one-window-p))
|
||||||
(pcase direction
|
(window-in-direction
|
||||||
(`right 'left)
|
(pcase direction
|
||||||
(`left 'right)
|
(`right 'left)
|
||||||
((or `up `above) 'down)
|
(`left 'right)
|
||||||
((or `down `below) 'up))))
|
((or `up `above) 'down)
|
||||||
|
((or `down `below) 'up)))))
|
||||||
(select-window window)
|
(select-window window)
|
||||||
(split-window-horizontally)))
|
(let ((window (split-window nil nil direction)))
|
||||||
(switch-to-buffer buffer)
|
(when (memq direction '(right down below))
|
||||||
|
(select-window window))
|
||||||
|
(display-buffer-record-window 'reuse window buffer)
|
||||||
|
(set-window-buffer window buffer)
|
||||||
|
(set-window-parameter window 'quit-restore (list 'window 'window origin-window buffer))
|
||||||
|
(set-window-prev-buffers window nil))))
|
||||||
|
(switch-to-buffer buffer t t)
|
||||||
(selected-window)))
|
(selected-window)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,8 @@ For example, diffs and log buffers. Accepts `left', `right', `up', and `down'.")
|
||||||
;; 2. The status screen isn't buried when viewing diffs or logs from the
|
;; 2. The status screen isn't buried when viewing diffs or logs from the
|
||||||
;; status screen.
|
;; status screen.
|
||||||
(setq transient-display-buffer-action '(display-buffer-below-selected)
|
(setq transient-display-buffer-action '(display-buffer-below-selected)
|
||||||
magit-display-buffer-function #'+magit-display-buffer-fn)
|
magit-display-buffer-function #'+magit-display-buffer-fn
|
||||||
|
magit-bury-buffer-function #'magit-mode-quit-window)
|
||||||
(set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t)
|
(set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t)
|
||||||
(add-hook 'magit-popup-mode-hook #'hide-mode-line-mode)
|
(add-hook 'magit-popup-mode-hook #'hide-mode-line-mode)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue