diff options
| author | Kyle Meyer <kyle@kyleam.com> | 2022-10-19 00:12:52 -0400 |
|---|---|---|
| committer | Kyle Meyer <kyle@kyleam.com> | 2022-10-19 00:12:52 -0400 |
| commit | 5d6c01e2934c7d6cfe85f47a68c3949164deb585 (patch) | |
| tree | 131bc0c1b0e2ff9988b373599781a4f518f9b28a /lisp | |
| parent | 47df80a46a0817747a34c0a8400f31ac0fc2a651 (diff) | |
magit-commit-squash-internal: Restore window conf after showing diff
When magit-commit-show-diff is non-nil, the diff window is typically
deleted by with-editor-return restoring the initial window
configuration, but it isn't deleted by commands that go through
magit-commit-squash-internal. In the case of
magit-commit{,-instant}-{fixup,squash}, this is because the editor
isn't invoked. For magit-commit-augment, the editor is invoked, but
the diff is already displayed by the time with-editor stores the
initial window configuration.
Teach magit-commit-squash-internal to restore the window configuration
so that these commands behave the same as other commit commands.
Closes #4767.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/magit-commit.el | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el index 8009221..c852065 100644 --- a/lisp/magit-commit.el +++ b/lisp/magit-commit.el @@ -317,18 +317,22 @@ depending on the value of option `magit-commit-squash-confirm'." args))) (magit-run-git-with-editor "commit" args)) t) ; The commit was created; used by below lambda. - (magit-log-select - (lambda (commit) - (when (and (magit-commit-squash-internal option commit args - rebase edit t) - rebase) - (magit-commit-amend-assert commit) - (magit-rebase-interactive-1 commit - (list "--autosquash" "--autostash" "--keep-empty") - "" "true" nil t))) - (format "Type %%p on a commit to %s into it," - (substring option 2)) - nil nil nil commit) + (let ((winconf (and magit-commit-show-diff + (current-window-configuration)))) + (magit-log-select + (lambda (commit) + (when (and (magit-commit-squash-internal option commit args + rebase edit t) + rebase) + (magit-commit-amend-assert commit) + (magit-rebase-interactive-1 commit + (list "--autosquash" "--autostash" "--keep-empty") + "" "true" nil t)) + (when winconf + (set-window-configuration winconf))) + (format "Type %%p on a commit to %s into it," + (substring option 2)) + nil nil nil commit)) (when magit-commit-show-diff (let ((magit-display-buffer-noselect t)) (apply #'magit-diff-staged nil (magit-diff-arguments))))))) |
