From b4cbdf15a15037d15dd249ba5f51ecd266e8f1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=A3=AE=E5=BD=AC?= Date: Tue, 28 Jun 2016 18:28:52 +0800 Subject: [PATCH] add git--commit-before-hook variable and run git--commit-before-hook hooks before commit the buffer. --- git-emacs.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git-emacs.el b/git-emacs.el index 32a6618..f19f37d 100644 --- a/git-emacs.el +++ b/git-emacs.el @@ -1200,6 +1200,8 @@ commit, like git commit --amend will do once we commit." "# Date : " (git--today) "\n"))) ;; Internal variables for commit +(defvar git--commit-before-hook nil + "Hooks to run before comitting the commit buffer.") (defvar git--commit-after-hook nil "Hooks to run after comitting (and killing) the commit buffer.") (defvar git--commit-args nil @@ -1225,6 +1227,9 @@ Trim the buffer log, commit runs any after-commit functions." git--commit-log-buffer) (error "Execute git commit on %s buffer" git--commit-log-buffer)) + ;; hooks (e.g. code check) + (run-hooks 'git--commit-before-hook) + ;; trail and commit (save-excursion (goto-char (point-min))