+2004-06-18 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * gnus-art.el (gnus-article-time-format): Exchange the order of
+ day and month in the default value; fix customization type.
+ (article-date-ut): Use add-text-properties.
+ (article-make-date-line): Use message-make-date instead of
+ current-time-string.
+
+ * message.el (message-fetch-field): Don't use set-text-properties.
+ (message-make-date): Simplify.
+
+ * messagexmas.el (message-xmas-make-date): New function.
+ (message-xmas-redefine): Defalias message-make-date to it.
+
2004-06-17 Katsumi Yamaoka <yamaoka@jpl.org>
* rfc2047.el (rfc2047-syntax-table): Treat `(' and `)' as is.
"Face used for displaying highlighted words."
:group 'gnus-article-emphasis)
-(defcustom gnus-article-time-format "%a, %b %d %Y %T %Z"
+(defcustom gnus-article-time-format "%a, %d %b %Y %T %Z"
"Format for display of Date headers in article bodies.
See `format-time-string' for the possible values.
The variable can also be function, which should return a complete Date
header. The function is called with one argument, the time, which can
be fed to `format-time-string'."
- :type '(choice string symbol)
+ :type '(choice string function)
:link '(custom-manual "(gnus)Article Date")
:group 'gnus-article-washing)
(forward-line -1)
;; Do highlighting.
(when (looking-at "\\([^:]+\\): *\\(.*\\)$")
- (put-text-property (match-beginning 1) (1+ (match-end 1))
- 'original-date date)
- (put-text-property (match-beginning 1) (1+ (match-end 1))
- 'face bface)
+ (add-text-properties (match-beginning 1) (1+ (match-end 1))
+ (list 'original-date date 'face bface))
(put-text-property (match-beginning 2) (match-end 2)
'face eface))))))))
(cond
;; Convert to the local timezone.
((eq type 'local)
- (let ((tz (car (current-time-zone time))))
- (format "Date: %s %s%02d%02d" (current-time-string time)
- (if (> tz 0) "+" "-") (/ (abs tz) 3600)
- (/ (% (abs tz) 3600) 60))))
+ (concat "Date: " (message-make-date time)))
;; Convert to Universal Time.
((eq type 'ut)
(concat "Date: "
- (current-time-string
- (let* ((e (parse-time-string date))
- (tm (apply 'encode-time e))
- (ms (car tm))
- (ls (- (cadr tm) (car (current-time-zone time)))))
- (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
- ((> ls 65535) (list (1+ ms) (- ls 65536)))
- (t (list ms ls)))))
- " UT"))
+ (substring
+ (message-make-date
+ (let* ((e (parse-time-string date))
+ (tm (apply 'encode-time e))
+ (ms (car tm))
+ (ls (- (cadr tm) (car (current-time-zone time)))))
+ (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
+ ((> ls 65535) (list (1+ ms) (- ls 65536)))
+ (t (list ms ls)))))
+ 0 -5)
+ "UT"))
;; Get the original date from the article.
((eq type 'original)
(concat "Date: " (if (string-match "\n+$" date)
(when value
(while (string-match "\n[\t ]+" value)
(setq value (replace-match " " t t value)))
- (set-text-properties 0 (length value) nil value)
value)))
(defun message-field-value (header &optional not-all)
(defun message-make-date (&optional now)
"Make a valid data header.
If NOW, use that time instead."
- (let* ((now (or now (current-time)))
- (zone (nth 8 (decode-time now)))
- (sign "+"))
- (when (< zone 0)
- (setq sign "-")
- (setq zone (- zone)))
- (concat
- ;; The day name of the %a spec is locale-specific. Pfff.
- (format "%s, " (capitalize (car (rassoc (nth 6 (decode-time now))
- parse-time-weekdays))))
- (format-time-string "%d" now)
- ;; The month name of the %b spec is locale-specific. Pfff.
- (format " %s "
- (capitalize (car (rassoc (nth 4 (decode-time now))
- parse-time-months))))
- (format-time-string "%Y %H:%M:%S " now)
- ;; We do all of this because XEmacs doesn't have the %z spec.
- (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60)))))
+ (let ((system-time-locale "C"))
+ (format-time-string "%a, %d %b %Y %T %z" now)))
(defun message-make-followup-subject (subject)
"Make a followup Subject."
;;; messagexmas.el --- XEmacs extensions to message
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(substring table a (+ a n))
(substring table (+ a 26) 255))))
+(defun message-xmas-make-date (&optional now)
+ "Make a valid data header.
+If NOW, use that time instead."
+ (let ((zone (car (current-time-zone)))
+ sign)
+ (if (>= zone 0)
+ (setq sign "+")
+ (setq sign "-"
+ zone (- zone)))
+ (format "%s %s%02d%02d"
+ (format-time-string "%a, %d %b %Y %T" now)
+ sign
+ (/ zone 3600)
+ (/ (% zone 3600) 60))))
+
(add-hook 'message-mode-hook 'message-xmas-maybe-fontify)
(defun message-xmas-redefine ()
'message-xmas-make-caesar-translation-table)
(defalias 'message-make-overlay 'make-extent)
(defalias 'message-delete-overlay 'delete-extent)
- (defalias 'message-overlay-put 'set-extent-property))
+ (defalias 'message-overlay-put 'set-extent-property)
+ (defalias 'message-make-date 'message-xmas-make-date))
(message-xmas-redefine)