aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/add-log.el43
1 files changed, 29 insertions, 14 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 3b963bd3bbe..4a935223cfe 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -2,7 +2,7 @@
2 2
3;; Copyright (C) 1985, 86, 88, 93, 94, 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1985, 86, 88, 93, 94, 1997 Free Software Foundation, Inc.
4 4
5;; Keywords: maint 5;; Keywords: tools
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
@@ -64,6 +64,17 @@ This defaults to the value of `user-mail-address'."
64 string) 64 string)
65 :group 'change-log) 65 :group 'change-log)
66 66
67(defcustom add-log-time-format 'add-log-iso8601-time-string
68 "*Function that defines the time format.
69For example, `add-log-iso8601-time-string', which gives the
70date in international ISO 8601 format,
71and `current-time-string' are two valid values."
72 :type '(radio (const :tag "International ISO 8601 format"
73 add-log-iso8601-time-string)
74 (const :tag "Old format, as returned by `current-time-string'"
75 current-time-string)
76 (function :tag "Other"))
77 :group 'change-log)
67 78
68(defvar change-log-font-lock-keywords 79(defvar change-log-font-lock-keywords
69 '(;; 80 '(;;
@@ -103,7 +114,7 @@ This defaults to the value of `user-mail-address'."
103It takes the same format as the TZ argument of `set-time-zone-rule'. 114It takes the same format as the TZ argument of `set-time-zone-rule'.
104If nil, use local time.") 115If nil, use local time.")
105 116
106(defun iso8601-time-zone (time) 117(defun add-log-iso8601-time-zone (time)
107 (let* ((utc-offset (or (car (current-time-zone time)) 0)) 118 (let* ((utc-offset (or (car (current-time-zone time)) 0))
108 (sign (if (< utc-offset 0) ?- ?+)) 119 (sign (if (< utc-offset 0) ?- ?+))
109 (sec (abs utc-offset)) 120 (sec (abs utc-offset))
@@ -116,6 +127,20 @@ If nil, use local time.")
116 (t "%c%02d")) 127 (t "%c%02d"))
117 sign hh mm ss))) 128 sign hh mm ss)))
118 129
130(defun add-log-iso8601-time-string ()
131 (if change-log-time-zone-rule
132 (let ((tz (getenv "TZ"))
133 (now (current-time)))
134 (unwind-protect
135 (progn
136 (set-time-zone-rule
137 change-log-time-zone-rule)
138 (concat
139 (format-time-string "%Y-%m-%d " now)
140 (add-log-iso8601-time-zone now)))
141 (set-time-zone-rule tz)))
142 (format-time-string "%Y-%m-%d")))
143
119(defun change-log-name () 144(defun change-log-name ()
120 (or change-log-default-name 145 (or change-log-default-name
121 (if (eq system-type 'vax-vms) 146 (if (eq system-type 'vax-vms)
@@ -197,6 +222,7 @@ current buffer to the complete file name."
197 (set (make-local-variable 'change-log-default-name) file-name) 222 (set (make-local-variable 'change-log-default-name) file-name)
198 file-name) 223 file-name)
199 224
225
200;;;###autoload 226;;;###autoload
201(defun add-change-log-entry (&optional whoami file-name other-window new-entry) 227(defun add-change-log-entry (&optional whoami file-name other-window new-entry)
202 "Find change log file and add an entry for today. 228 "Find change log file and add an entry for today.
@@ -245,18 +271,7 @@ never append to an existing entry. Today's date is calculated according to
245 (change-log-mode)) 271 (change-log-mode))
246 (undo-boundary) 272 (undo-boundary)
247 (goto-char (point-min)) 273 (goto-char (point-min))
248 (let ((new-entry (concat (if change-log-time-zone-rule 274 (let ((new-entry (concat (funcall add-log-time-format)
249 (let ((tz (getenv "TZ"))
250 (now (current-time)))
251 (unwind-protect
252 (progn
253 (set-time-zone-rule
254 change-log-time-zone-rule)
255 (concat
256 (format-time-string "%Y-%m-%d " now)
257 (iso8601-time-zone now)))
258 (set-time-zone-rule tz)))
259 (format-time-string "%Y-%m-%d"))
260 " " add-log-full-name 275 " " add-log-full-name
261 " <" add-log-mailing-address ">"))) 276 " <" add-log-mailing-address ">")))
262 (if (looking-at (regexp-quote new-entry)) 277 (if (looking-at (regexp-quote new-entry))