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

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

[nongnu] elpa/git-commit 3af07129bc 09/10: magit-commit-diff: Remember c


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 3af07129bc 09/10: magit-commit-diff: Remember commit command
Date: Tue, 7 Jun 2022 10:58:26 -0400 (EDT)

branch: elpa/git-commit
commit 3af07129bc0ca437ab46ced5400ed3288a0762e4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-commit-diff: Remember commit command
---
 lisp/git-commit.el   | 3 +++
 lisp/magit-commit.el | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 883f082e04..c1a29f35bc 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -556,6 +556,9 @@ to recover older messages")
             #'git-commit-save-message nil t)
   (add-hook 'with-editor-pre-cancel-hook
             #'git-commit-save-message nil t)
+  (when (fboundp 'magit-commit--reset-command)
+    (add-hook 'with-editor-post-finish-hook #'magit-commit--reset-command)
+    (add-hook 'with-editor-post-cancel-hook #'magit-commit--reset-command))
   (when (and (fboundp 'magit-rev-parse)
              (not (memq last-command
                         '(magit-sequencer-continue
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 2bb0a166bd..1617f95d19 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -546,6 +546,7 @@ See `magit-commit-absorb' for an alternative 
implementation."
 ;;; Pending Diff
 
 (defun magit-commit-diff ()
+  (magit-repository-local-set 'this-commit-command last-command)
   (when (and git-commit-mode magit-commit-show-diff)
     (when-let ((diff-buffer (magit-get-mode-buffer 'magit-diff-mode)))
       ;; This window just started displaying the commit message
@@ -562,7 +563,7 @@ See `magit-commit-absorb' for an alternative 
implementation."
   (let ((rev nil)
         (arg "--cached")
         (msg nil))
-    (pcase last-command
+    (pcase (magit-repository-local-get 'this-commit-command)
       ((guard (eq this-command 'magit-diff-while-committing))
        (if-let ((diff-buf (magit-get-mode-buffer 'magit-diff-mode 'selected)))
            (with-current-buffer diff-buf
@@ -605,6 +606,9 @@ See `magit-commit-absorb' for an alternative 
implementation."
 (add-to-list 'with-editor-server-window-alist
              (cons git-commit-filename-regexp #'switch-to-buffer))
 
+(defun magit-commit--reset-command ()
+  (magit-repository-local-delete 'this-commit-command))
+
 ;;; Message Utilities
 
 (defun magit-commit-message-buffer ()



reply via email to

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