From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#16170: Customizable log-edit commit messages Date: Tue, 17 Dec 2013 02:38:02 +0200 Organization: JURTA Message-ID: <87fvpsgvmd.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1387244178 11642 80.91.229.3 (17 Dec 2013 01:36:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Dec 2013 01:36:18 +0000 (UTC) To: 16170@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 17 02:36:23 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VsjaA-0001q5-VV for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Dec 2013 02:36:23 +0100 Original-Received: from localhost ([::1]:59209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjaA-0000xE-7l for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Dec 2013 20:36:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjZz-0000wH-Di for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:36:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsjZr-0007Cx-0J for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:36:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjZq-0007Ct-Si for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VsjZq-0003WX-6q for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Dec 2013 01:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16170 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138724412013467 (code B ref -1); Tue, 17 Dec 2013 01:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Dec 2013 01:35:20 +0000 Original-Received: from localhost ([127.0.0.1]:54681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsjZ9-0003V6-Gw for submit@debbugs.gnu.org; Mon, 16 Dec 2013 20:35:19 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34820) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsjZ7-0003Uy-H0 for submit@debbugs.gnu.org; Mon, 16 Dec 2013 20:35:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsjYy-00077R-MR for submit@debbugs.gnu.org; Mon, 16 Dec 2013 20:35:17 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjYy-00077N-KL for submit@debbugs.gnu.org; Mon, 16 Dec 2013 20:35:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjYs-0000pX-IR for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:35:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsjYm-0006oo-C7 for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:35:02 -0500 Original-Received: from [69.163.184.122] (port=47634 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsjYm-0006oc-3O for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 20:34:56 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.184.122]) by ps18281.dreamhostps.com (Postfix) with ESMTP id DE268303236A33 for ; Mon, 16 Dec 2013 17:12:33 -0800 (PST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82102 Archived-At: 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))))))))