GNU bug report logs - #16170
Customizable log-edit commit messages

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 17 Dec 2013 01:36:01 UTC

Severity: wishlist

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16170 in the body.
You can then email your comments to 16170 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16170; Package emacs. (Tue, 17 Dec 2013 01:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Dec 2013 01:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Customizable log-edit commit messages
Date: Tue, 17 Dec 2013 02:38:02 +0200
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))))))))
 





Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Wed, 18 Dec 2013 23:54:02 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> jurta.org>:
bug acknowledged by developer. (Wed, 18 Dec 2013 23:54:03 GMT) Full text and rfc822 format available.

Message #10 received at 16170-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 16170-done <at> debbugs.gnu.org
Subject: Re: bug#16170: Customizable log-edit commit messages
Date: Thu, 19 Dec 2013 01:52:45 +0200
> 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'.

This is a useful addition to accompany log-edit-insert-filenames
to insert the names of files that don't require ChangeLog entry,
but should be mentioned in the commit message:

=== 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-18 23:52:35 +0000
@@ -137,6 +137,7 @@
 			 log-edit-insert-cvs-template
 			 log-edit-insert-changelog
 			 log-edit-insert-filenames
+                        log-edit-insert-filenames-without-changelog
 			 log-edit-show-files)))
 
 (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook)
@@ -664,6 +666,21 @@
   (insert "Affected files:  \n"
           (mapconcat 'identity (log-edit-files) "  \n")))
 
+(defun log-edit-insert-filenames-without-changelog ()
+  "Insert the list of files that have no ChangeLog message."
+  (interactive)
+  (let ((files
+	 (delq nil
+	       (mapcar
+		(lambda (file)
+		  (unless (or (cdr-safe (log-edit-changelog-entries file))
+			      (equal (file-name-nondirectory file) "ChangeLog"))
+		    file))
+		(log-edit-files)))))
+    (when files
+      (goto-char (point-max))
+      (insert (mapconcat 'identity files ", ") ": "))))
+
 (defun log-edit-add-to-changelog ()
   "Insert this log message into the appropriate ChangeLog file."
   (interactive)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Jan 2014 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.