diff lisp/packages/add-log.el @ 161:28f395d8dc7a r20-3b7

Import from CVS: tag r20-3b7
author cvs
date Mon, 13 Aug 2007 09:42:26 +0200
parents 59463afc5666
children 8eaf7971accc
line wrap: on
line diff
--- a/lisp/packages/add-log.el	Mon Aug 13 09:41:47 2007 +0200
+++ b/lisp/packages/add-log.el	Mon Aug 13 09:42:26 2007 +0200
@@ -32,18 +32,17 @@
 (defgroup change-log nil
   "Change log maintenance"
   :group 'tools
+  :group 'maint
   :prefix "change-log-"
   :prefix "add-log-")
 
 
-;;;###autoload
 (defcustom change-log-default-name nil
   "*Name of a change log file for \\[add-change-log-entry]."
   :type '(choice (const :tag "default" nil)
 		 string)
   :group 'change-log)
 
-;;;###autoload
 (defcustom add-log-current-defun-function nil
   "\
 *If non-nil, function to guess name of current function from surrounding text.
@@ -52,7 +51,6 @@
   :type 'boolean
   :group 'change-log)
 
-;;;###autoload
 (defcustom add-log-full-name nil
   "*Full name of user, for inclusion in ChangeLog daily headers.
 This defaults to the value returned by the `user-full-name' function."
@@ -60,11 +58,6 @@
 		 string)
   :group 'change-log)
 
-;; XEmacs;
-;; So that the dump-time value doesn't go into loaddefs.el with the autoload.
-(or add-log-full-name (setq add-log-full-name (user-full-name)))
-
-;;;###autoload
 (defcustom add-log-mailing-address nil
   "*Electronic mail address of user, for inclusion in ChangeLog daily headers.
 This defaults to the value of `user-mail-address'."
@@ -72,10 +65,16 @@
 		 string)
   :group 'change-log)
 
-;; XEmacs:
-;; So that the dump-time value doesn't go into loaddefs.el with the autoload.
-(or add-log-mailing-address
-    (setq add-log-mailing-address (user-mail-address)))
+(defcustom add-log-time-format 'iso8601-time-string
+  "*Function that defines the time format.
+For example, `iso8601-time-string' (time in international ISO 8601 format)
+and `current-time-string' are valid values."
+  :type '(radio (const :tag "International ISO 8601 format" iso8601-time-string)
+		(const :tag "Old format, as returned by `current-time-string'"
+		       current-time-string)
+		(function :tag "Other"))
+  :group 'change-log)
+
 
 (defvar change-log-font-lock-keywords
   '(;;
@@ -130,6 +129,20 @@
 		  (t "%c%02d"))
 	    sign hh mm ss)))
 
+(defun iso8601-time-string ()
+  (if change-log-time-zone-rule
+      (let ((tz (getenv "TZ"))
+	    (now (current-time)))
+	(unwind-protect
+	    (progn
+	      (set-time-zone-rule
+	       change-log-time-zone-rule)
+	      (concat
+	       (format-time-string "%Y-%m-%d " now)
+	       (iso8601-time-zone now)))
+	  (set-time-zone-rule tz)))
+    (format-time-string "%Y-%m-%d")))
+
 (defun change-log-name ()
   (or change-log-default-name
       (if (eq system-type 'vax-vms) 
@@ -211,6 +224,7 @@
   (set (make-local-variable 'change-log-default-name) file-name)
   file-name)
 
+
 ;;;###autoload
 (defun add-change-log-entry (&optional whoami file-name other-window new-entry)
   "Find change log file and add an entry for today.
@@ -259,18 +273,7 @@
 	(change-log-mode))
     (undo-boundary)
     (goto-char (point-min))
-    (let ((new-entry (concat (if change-log-time-zone-rule
-				 (let ((tz (getenv "TZ"))
-				       (now (current-time)))
-				   (unwind-protect
-				       (progn
-					 (set-time-zone-rule
-					  change-log-time-zone-rule)
-					 (concat
-					  (format-time-string "%Y-%m-%d " now)
-					  (iso8601-time-zone now)))
-				     (set-time-zone-rule tz)))
-			       (format-time-string "%Y-%m-%d"))
+    (let ((new-entry (concat (funcall add-log-time-format)
 			     "  " add-log-full-name
 			     "  <" add-log-mailing-address ">")))
       (if (looking-at (regexp-quote new-entry))