Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an irregular hook for after commits #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions git-auto-commit-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,18 @@ If non-nil a git push will be executed after each commit."
:type 'string)

(defcustom gac-silent-message-p nil
"Should git output be output to the message area?"
:tag "Quiet message output"
:group 'git-auto-commit-mode
:type 'boolean)
"Should git output be output to the message area?"
:tag "Quiet message output"
:group 'git-auto-commit-mode
:type 'boolean)

(defcustom gac-post-commit-functions nil
"Functions to run after commit.

Functions will be called as an irregular hook, with a single
argument (FILENAME)."
:group 'git-auto-commit-mod
:type 'hook)

(defcustom gac-debounce-interval nil
"Debounce automatic commits to avoid hammering Git.
Expand Down Expand Up @@ -175,13 +182,14 @@ Default to FILENAME."
(file-name-nondirectory buffer-file)))
(commit-msg (gac--commit-msg buffer-file))
(default-directory (file-name-directory buffer-file)))
(funcall (if gac-silent-message-p
#'call-process-shell-command
#'shell-command)
(concat "git add " gac-add-additional-flag " " (shell-quote-argument filename)
gac-shell-and
"git commit -m " (shell-quote-argument commit-msg)
" " gac-commit-additional-flag))))
(prog1 (funcall (if gac-silent-message-p
#'call-process-shell-command
#'shell-command)
(concat "git add " gac-add-additional-flag " " (shell-quote-argument filename)
gac-shell-and
"git commit -m " (shell-quote-argument commit-msg)
" " gac-commit-additional-flag))
(run-hook-with-args 'gac-post-commit-functions filename))))

(defun gac-push (buffer)
"Push commits to the current upstream.
Expand Down