summaryrefslogtreecommitdiff
path: root/lisp/add-log.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-06-17 04:27:37 +0000
committerRichard M. Stallman <rms@gnu.org>1997-06-17 04:27:37 +0000
commit1896f44cf339946d74e5c916ec30a35431302f7b (patch)
treee26e365fc6e86bcced0cfb42c8cb4a5e514c05bd /lisp/add-log.el
parent01bb3a9f3ac04a0612cb2d4f953bd83d29c13c1d (diff)
downloademacs-1896f44cf339946d74e5c916ec30a35431302f7b.tar.gz
(add-log-time-format): New variable.
(add-log-iso8601-time-string): New function. (add-change-log-entry): Use add-log-time-format. (add-log-iso8601-time-zone): Renamed from iso8601-time-zone.
Diffstat (limited to 'lisp/add-log.el')
-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 @@
;; Copyright (C) 1985, 86, 88, 93, 94, 1997 Free Software Foundation, Inc.
-;; Keywords: maint
+;; Keywords: tools
;; This file is part of GNU Emacs.
@@ -64,6 +64,17 @@ This defaults to the value of `user-mail-address'."
string)
:group 'change-log)
+(defcustom add-log-time-format 'add-log-iso8601-time-string
+ "*Function that defines the time format.
+For example, `add-log-iso8601-time-string', which gives the
+date in international ISO 8601 format,
+and `current-time-string' are two valid values."
+ :type '(radio (const :tag "International ISO 8601 format"
+ add-log-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
'(;;
@@ -103,7 +114,7 @@ This defaults to the value of `user-mail-address'."
It takes the same format as the TZ argument of `set-time-zone-rule'.
If nil, use local time.")
-(defun iso8601-time-zone (time)
+(defun add-log-iso8601-time-zone (time)
(let* ((utc-offset (or (car (current-time-zone time)) 0))
(sign (if (< utc-offset 0) ?- ?+))
(sec (abs utc-offset))
@@ -116,6 +127,20 @@ If nil, use local time.")
(t "%c%02d"))
sign hh mm ss)))
+(defun add-log-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)
+ (add-log-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)
@@ -197,6 +222,7 @@ current buffer to the complete file name."
(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.
@@ -245,18 +271,7 @@ never append to an existing entry. Today's date is calculated according to
(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))