diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2021-09-10 12:07:44 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2021-09-10 12:14:27 +0200 |
| commit | 5a8e3aec35d64939e5a46430bdfce773a78cd44b (patch) | |
| tree | 1f7bb515f913df92dc0dc29d0d01060141011486 /lisp/magit-commit.el | |
| parent | e404aa75a791fa577973176a7eb2f2da3b572b87 (diff) | |
magit-commit-diff-inhibit-same-window: New option
Different users need mutually exclusive kludges,
therefore we need an option. See #4132 for details.
Diffstat (limited to 'lisp/magit-commit.el')
| -rw-r--r-- | lisp/magit-commit.el | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el index 51f6405..133ef4b 100644 --- a/lisp/magit-commit.el +++ b/lisp/magit-commit.el @@ -91,6 +91,34 @@ Also see `git-commit-post-finish-hook'." :group 'magit-commands :type 'hook) +(defcustom magit-commit-diff-inhibit-same-window nil + "Whether to inhibit use of same window when showing diff while committing. + +When writing a commit, then a diff of the changes to be committed +is automatically shown. The idea is that the diff is shown in a +different window of the same frame and for most users that just +works. In other words most users can completely ignore this +option because its value doesn't make a difference for them. + +However for users who configured Emacs to never create a new +window even when the package explicitly tries to do so, then +displaying two new buffers necessarily means that the first is +immediately replaced by the second. In our case the message +buffer is immediately replaced by the diff buffer, which is of +course highly undesirable. + +A workaround is to suppress this user configuration in this +particular case. Users have to explicitly opt-in by toggling +this option. We cannot enable the workaround unconditionally +because that again causes issues for other users: if the frame +is too tiny or the relevant settings too aggressive, then the +diff buffer would end up being displayed in a new frame. + +Also see https://github.com/magit/magit/issues/4132." + :package-version '(magit . "3.3.0") + :group 'magit-commands + :type 'boolean) + (defvar magit-post-commit-hook-commands '(magit-commit-extend magit-commit-fixup @@ -574,7 +602,11 @@ See `magit-commit-absorb' for an alternative implementation." (magit-inhibit-save-previous-winconf 'unset) (magit-display-buffer-noselect t) (inhibit-quit nil) - (display-buffer-overriding-action '(nil (inhibit-same-window t)))) + (display-buffer-overriding-action + display-buffer-overriding-action)) + (when magit-commit-diff-inhibit-same-window + (setq display-buffer-overriding-action + '(nil (inhibit-same-window t)))) (message "Diffing changes to be committed (C-g to abort diffing)") (cl-case last-command (magit-commit |
