emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 5d6c01e293: magit-commit-squash-internal: Resto


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 5d6c01e293: magit-commit-squash-internal: Restore window conf after showing diff
Date: Wed, 19 Oct 2022 00:58:49 -0400 (EDT)

branch: elpa/git-commit
commit 5d6c01e2934c7d6cfe85f47a68c3949164deb585
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    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.
---
 lisp/magit-commit.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 800922164b..c85206567d 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)))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]