Created
June 7, 2010 23:35
-
-
Save willert/429350 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun git-commit-insert-header (type name email &optional note) | |
(let* ((signoff-at (git-commit-find-pseudo-header-position)) | |
(prev-line (progn | |
(save-excursion | |
(goto-char (- signoff-at 1)) | |
(thing-at-point 'line)))) | |
(pre (if (or (string-match "^[^\s:]+:.+$" prev-line) | |
(string-match "\\`\s*$" prev-line)) | |
"" "\n")) | |
(org (pointer))) | |
(goto-char signoff-at) | |
(insert (format "%s%s: %s <%s>\n" pre type name email)) | |
(when note | |
(insert (format "[%s: ]\n" email)) | |
(backward-char 2) | |
(when (stringp note) (insert note) (goto-char org))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment