branch: elpa/magit
commit 5e05d1b08394eee85f1db28911b87e07aa006a97
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-maybe-save-repository-buffers: Add to hooks in their definition
    
    For `magit-pre-refresh-hook' that is already being done.
---
 lisp/magit-mode.el    | 4 ----
 lisp/magit-process.el | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 8fc74180771..7becc742062 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1179,10 +1179,6 @@ if you so desire."
                  (not (equal msg (current-message))))
         (message "%s" msg)))))
 
-(add-hook 'magit-pre-refresh-hook #'magit-maybe-save-repository-buffers)
-(add-hook 'magit-pre-call-git-hook #'magit-maybe-save-repository-buffers)
-(add-hook 'magit-pre-start-git-hook #'magit-maybe-save-repository-buffers)
-
 (defvar-local magit-inhibit-refresh-save nil)
 
 (defun magit-save-repository-buffers (&optional arg)
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index 47fd6090892..179abca9e85 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -416,7 +416,7 @@ Process output goes into a new section in the buffer 
returned by
         (setq magit--refresh-cache nil))
       (magit-refresh))))
 
-(defvar magit-pre-call-git-hook nil)
+(defvar magit-pre-call-git-hook (list #'magit-maybe-save-repository-buffers))
 
 (defun magit-call-git (&rest args)
   "Call Git synchronously in a separate process.
@@ -579,7 +579,7 @@ See `magit-start-process' and `with-editor' for more 
information."
   (set-process-sentinel magit-this-process #'magit-sequencer-process-sentinel)
   magit-this-process)
 
-(defvar magit-pre-start-git-hook nil)
+(defvar magit-pre-start-git-hook (list #'magit-maybe-save-repository-buffers))
 
 (defun magit-start-git (input &rest args)
   "Start Git, prepare for refresh, and return the process object.

Reply via email to