From: Juri Linkov <juri@jurta.org>
To: 16170@debbugs.gnu.org
Subject: bug#16170: Customizable log-edit commit messages
Date: Tue, 17 Dec 2013 02:38:02 +0200 [thread overview]
Message-ID: <87fvpsgvmd.fsf@mail.jurta.org> (raw)
Currently the commit message is hard-coded that might be unsuitable
to other projects with different conventions. This patch leaves the
current default unchanged, and moves it to a separate function,
so a set of messages could by easily configured in `log-edit-hook'.
Adding `save-excursion' to `log-edit-insert-cvs-template' was
necessary to not move point set by `message-position-point' in
`log-edit-insert-message-template'.
=== modified file 'lisp/vc/log-edit.el'
--- lisp/vc/log-edit.el 2013-12-04 00:37:33 +0000
+++ lisp/vc/log-edit.el 2013-12-17 00:34:35 +0000
@@ -126,12 +126,14 @@ (defcustom log-edit-setup-add-author nil
:type 'boolean
:safe 'booleanp)
-(defcustom log-edit-hook '(log-edit-insert-cvs-template
+(defcustom log-edit-hook '(log-edit-insert-message-template
+ log-edit-insert-cvs-template
log-edit-show-files
log-edit-insert-changelog)
"Hook run at the end of `log-edit'."
:group 'log-edit
- :type '(hook :options (log-edit-insert-changelog
+ :type '(hook :options (log-edit-insert-message-template
+ log-edit-insert-changelog
log-edit-insert-cvs-rcstemplate
log-edit-insert-cvs-template
log-edit-insert-filenames)))
@@ -440,12 +442,6 @@ (defun log-edit (callback &optional setu
(if mode
(funcall mode)
(log-edit-mode))
- (when setup
- (erase-buffer)
- (insert "Summary: ")
- (when log-edit-setup-add-author
- (insert "\nAuthor: "))
- (insert "\n\n"))
(set (make-local-variable 'log-edit-callback) callback)
(if (listp params)
(dolist (crt params)
@@ -456,10 +452,9 @@ (defun log-edit (callback &optional setu
(if buffer (set (make-local-variable 'log-edit-parent-buffer) parent))
(set (make-local-variable 'log-edit-initial-files) (log-edit-files))
- (when setup (run-hooks 'log-edit-hook))
- (if setup
- (message-position-point)
- (goto-char (point-min)))
+ (when setup
+ (erase-buffer)
+ (run-hooks 'log-edit-hook))
(push-mark (point-max))
(message "%s" (substitute-command-keys
"Press \\[log-edit-done] when you are done editing."))))
@@ -626,6 +621,17 @@ (defun log-edit-empty-buffer-p ()
(zerop (forward-line 1))))
(eobp))))
+(defun log-edit-insert-message-template ()
+ "Insert the default template with Summary and Author."
+ (interactive)
+ (when (or (called-interactively-p 'interactive)
+ (log-edit-empty-buffer-p))
+ (insert "Summary: ")
+ (when log-edit-setup-add-author
+ (insert "\nAuthor: "))
+ (insert "\n\n")
+ (message-position-point)))
+
(defun log-edit-insert-cvs-template ()
"Insert the template specified by the CVS administrator, if any.
This simply uses the local CVS/Template file."
@@ -701,6 +707,7 @@ (defun log-edit-insert-changelog (&optio
or if the command is repeated a second time in a row, use the first log entry
regardless of user name or time."
(interactive "P")
+ (save-excursion
(let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
(when (<= (point) eoh)
(goto-char eoh)
@@ -732,8 +739,7 @@ (defun log-edit-insert-changelog (&optio
(goto-char start)
(skip-chars-forward "^():")
(skip-chars-forward ": ")
- (delete-region start (point)))))
- (goto-char (point-min))))
+ (delete-region start (point))))))))
next reply other threads:[~2013-12-17 0:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 0:38 Juri Linkov [this message]
2013-12-18 23:52 ` bug#16170: Customizable log-edit commit messages Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fvpsgvmd.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=16170@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.