branch: elpa/magit
commit 97dbb5923d3c522d13ed558684a026a564ae6b6a
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
Collect magit-post-commit-hook and support in one place
The goal is to (at least semi-) deprecate this eventually,
which is why I want it out of the way.
---
lisp/magit-commit.el | 58 ++++++++++++++++++++++++++--------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 4e4771c52b2..44b5557f920 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -71,20 +71,6 @@ an error while using those is harder to recover from."
:group 'magit-commands
:type 'boolean)
-(defcustom magit-post-commit-hook nil
- "Hook run after creating a commit without the user editing a message.
-
-This hook is run by `magit-refresh' if `this-command' is a member
-of `magit-post-commit-hook-commands'. This only includes commands
-named `magit-commit-*' that do *not* require that the user edits
-the commit message in a buffer and then finishes by pressing
-\\<with-editor-mode-map>\\[with-editor-finish].
-
-Also see `git-commit-post-finish-hook'."
- :package-version '(magit . "2.90.0")
- :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.
@@ -637,21 +623,6 @@ an alternative implementation."
:argument "--strict="
:reader #'transient-read-number-N0)
-;;;; Hooks
-
-(defvar magit-post-commit-hook-commands
- (list #'magit-commit-extend
- #'magit-commit-fixup
- #'magit-commit-augment
- #'magit-commit-instant-fixup
- #'magit-commit-instant-squash))
-
-;;;###autoload
-(defun magit-run-post-commit-hook ()
- (when (and (not this-command)
- (memq last-command magit-post-commit-hook-commands))
- (run-hooks 'magit-post-commit-hook)))
-
;;; Pending Diff
(defun magit-commit-diff ()
@@ -812,6 +783,35 @@ actually insert the entry."
(insert (format "(%s): \n" defun))
(backward-char)))))))
+;;; Post Hook
+
+(defcustom magit-post-commit-hook nil
+ "Hook run after creating a commit without the user editing a message.
+
+This hook is run by `magit-refresh' if `this-command' is a member
+of `magit-post-commit-hook-commands'. This only includes commands
+named `magit-commit-*' that do *not* require that the user edits
+the commit message in a buffer and then finishes by pressing
+\\<with-editor-mode-map>\\[with-editor-finish].
+
+Also see `git-commit-post-finish-hook'."
+ :package-version '(magit . "2.90.0")
+ :group 'magit-commands
+ :type 'hook)
+
+(defvar magit-post-commit-hook-commands
+ (list #'magit-commit-extend
+ #'magit-commit-fixup
+ #'magit-commit-augment
+ #'magit-commit-instant-fixup
+ #'magit-commit-instant-squash))
+
+;;;###autoload
+(defun magit-run-post-commit-hook ()
+ (when (and (not this-command)
+ (memq last-command magit-post-commit-hook-commands))
+ (run-hooks 'magit-post-commit-hook)))
+
;;; _
(provide 'magit-commit)
;; Local Variables: