Emacs: Workaround for magit split problem.
This commit is contained in:
parent
ad17ba7ea6
commit
8342589400
|
@ -1,6 +1,6 @@
|
|||
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Time-stamp: <2020-01-26T09:05:30+0100>
|
||||
;; Time-stamp: <2020-01-26T20:35:54+0100>
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
|
@ -265,13 +265,17 @@
|
|||
(magit-diff-refine-hunk 'all) ; Show word-granularity differences.
|
||||
|
||||
:config
|
||||
(defun my/split-vertically ()
|
||||
"Split buffers vertically if focused window is dedicated to a
|
||||
purpose or not wide enough."
|
||||
(when (or (purpose-window-purpose-dedicated-p)
|
||||
(< (window-total-width) 160))
|
||||
(setq-local split-height-threshold 40)
|
||||
))
|
||||
(defun my/magit-display-buffer (buffer)
|
||||
"Workaround to ensure that BUFFER is split vertically if necessary."
|
||||
(if (and git-commit-mode
|
||||
(with-current-buffer buffer
|
||||
(derived-mode-p 'magit-diff-mode)))
|
||||
(display-buffer buffer '((display-buffer-pop-up-window
|
||||
display-buffer-use-some-window
|
||||
display-buffer-below-selected)
|
||||
(inhibit-same-window . t)))
|
||||
(magit-display-buffer-traditional buffer)))
|
||||
(setq magit-display-buffer-function #'my/magit-display-buffer)
|
||||
|
||||
:bind
|
||||
("C-x g" . magit-status)
|
||||
|
@ -279,8 +283,6 @@ purpose or not wide enough."
|
|||
|
||||
:hook
|
||||
(after-save . magit-after-save-refresh-status)
|
||||
;; (magit-pre-display-buffer . my/split-vertically)
|
||||
;; (git-commit-setup . my/split-vertically)
|
||||
)
|
||||
|
||||
;; Use libgit rather than git.
|
||||
|
|
Loading…
Reference in New Issue
Block a user