Emacs: Workaround for magit split problem.

This commit is contained in:
tastytea 2020-01-26 21:45:56 +01:00
parent ad17ba7ea6
commit 8342589400

View File

@ -1,6 +1,6 @@
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*- ;;; 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: ;;; Commentary:
@ -265,13 +265,17 @@
(magit-diff-refine-hunk 'all) ; Show word-granularity differences. (magit-diff-refine-hunk 'all) ; Show word-granularity differences.
:config :config
(defun my/split-vertically () (defun my/magit-display-buffer (buffer)
"Split buffers vertically if focused window is dedicated to a "Workaround to ensure that BUFFER is split vertically if necessary."
purpose or not wide enough." (if (and git-commit-mode
(when (or (purpose-window-purpose-dedicated-p) (with-current-buffer buffer
(< (window-total-width) 160)) (derived-mode-p 'magit-diff-mode)))
(setq-local split-height-threshold 40) (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 :bind
("C-x g" . magit-status) ("C-x g" . magit-status)
@ -279,8 +283,6 @@ purpose or not wide enough."
:hook :hook
(after-save . magit-after-save-refresh-status) (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. ;; Use libgit rather than git.