git-auto-commit-mode.el

This commit is contained in:
Thibaut Verron 2019-11-21 13:02:03 +01:00
parent 2f05046731
commit 4a8a7e0271

View file

@ -75,6 +75,21 @@ is subject to its limitations."
(const :tag "Off" nil))) (const :tag "Off" nil)))
(make-variable-buffer-local 'gac-debounce-interval) (make-variable-buffer-local 'gac-debounce-interval)
(defcustom gac-default-message nil
"Default message for automatic commits.
It can be:
- nil to use the default FILENAME
- a string which is used
- a function returning a string, called without argument in the
current buffer, the result being used as message
"
:tag "Default commit message"
:group 'git-auto-commit-mode
:type '(choice (string :tag "Commit message")
(const :tag "Default: FILENAME" nil)
(function :tag "Function")))
(defun gac-relative-file-name (filename) (defun gac-relative-file-name (filename)
"Find the path to FILENAME relative to the git directory." "Find the path to FILENAME relative to the git directory."
(let* ((git-dir (let* ((git-dir
@ -123,7 +138,7 @@ STRING is the output line from PROC."
Default to FILENAME." Default to FILENAME."
(let ((relative-filename (gac-relative-file-name filename))) (let ((relative-filename (gac-relative-file-name filename)))
(if (not gac-ask-for-summary-p) (if (not gac-ask-for-summary-p)
relative-filename (or gac-default-message relative-filename)
(read-string "Summary: " nil nil relative-filename)))) (read-string "Summary: " nil nil relative-filename))))
(defun gac-commit (buffer) (defun gac-commit (buffer)