From: hmurata Date: Sat, 9 Apr 2005 06:12:26 +0000 (+0000) Subject: * wl-summary.el (wl-summary-create-line): Use X-Git-Tag: wl-2_15_3~87 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d451184a85f4fdfab92a70df6dfcace263b7a6f;p=elisp%2Fwanderlust.git * wl-summary.el (wl-summary-create-line): Use `elmo-time-to-datevec'. * wl-expire.el (wl-expire-archive-date): Ditto. (wl-expire-localdir-date): Ditto. * elmo-date.el (elmo-time-less-p): Renamed from `elmo-time<'. (elmo-time<): Define as alias of `elmo-time-less-p'. (elmo-time-to-datevec): New function. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 3d02c5e..ed8e363 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,9 @@ 2005-04-09 Hiroya Murata + * elmo-date.el (elmo-time-less-p): Renamed from `elmo-time<'. + (elmo-time<): Define as alias of `elmo-time-less-p'. + (elmo-time-to-datevec): New function. + * elmo-date.el (elmo-time-to-days): New function. 2005-04-08 Hiroya Murata diff --git a/elmo/elmo-date.el b/elmo/elmo-date.el index 215c36a..1f330fa 100644 --- a/elmo/elmo-date.el +++ b/elmo/elmo-date.el @@ -224,7 +224,7 @@ Otherwise treat \\ in NEWTEXT string as special: (let ((system-time-locale "C")) (format-time-string "%a, %d %b %Y %T %z" time))) -(defun elmo-time< (lhs rhs) +(defun elmo-time-less-p (lhs rhs) (while (and (car lhs) (car rhs)) (cond ((< (car lhs) (car rhs)) (setq lhs nil)) @@ -235,11 +235,55 @@ Otherwise treat \\ in NEWTEXT string as special: (setq rhs nil)))) (not (null rhs))) +(defalias 'elmo-time< 'elmo-time-less-p) + (defun elmo-time-to-days (time) (let ((date (decode-time time))) (timezone-absolute-from-gregorian (nth 4 date) (nth 3 date) (nth 5 date)))) +;; from timezone-fix-time in `timezone.el' +(defun elmo-time-to-datevec (time &optional timezone) + (when time + (let* ((date (decode-time time)) + (year (nth 5 date)) + (month (nth 4 date)) + (day (nth 3 date)) + (hour (nth 2 date)) + (minute (nth 1 date)) + (second (nth 0 date)) + (local (nth 8 date)) + (timezone + (or timezone + (timezone-time-zone-from-absolute + (timezone-absolute-from-gregorian month day year) + (+ second (* 60 (+ minute (* 60 hour))))))) + (diff (- (timezone-zone-to-minute timezone) (/ local 60))) + (minute (+ minute diff)) + (hour-fix (floor minute 60))) + (setq hour (+ hour hour-fix)) + (setq minute (- minute (* 60 hour-fix))) + ;; HOUR may be larger than 24 or smaller than 0. + (cond ((<= 24 hour) ;24 -> 00 + (setq hour (- hour 24)) + (setq day (1+ day)) + (when (< (timezone-last-day-of-month month year) day) + (setq month (1+ month)) + (setq day 1) + (when (< 12 month) + (setq month 1) + (setq year (1+ year))))) + ((> 0 hour) + (setq hour (+ hour 24)) + (setq day (1- day)) + (when (> 1 day) + (setq month (1- month)) + (when (> 1 month) + (setq month 12) + (setq year (1- year))) + (setq day (timezone-last-day-of-month month year))))) + (vector year month day hour minute second timezone)))) + (require 'product) (product-provide (provide 'elmo-date) (require 'elmo-version)) diff --git a/wl/ChangeLog b/wl/ChangeLog index 2fb55f8..72dce7e 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,11 @@ 2005-04-09 Hiroya Murata + * wl-summary.el (wl-summary-create-line): Use + `elmo-time-to-datevec'. + + * wl-expire.el (wl-expire-archive-date): Ditto. + (wl-expire-localdir-date): Ditto. + * wl-util.el (wl-day-number): Abolish. * wl-score.el (wl-score-headers): Use `elmo-time-to-days' instead diff --git a/wl/wl-expire.el b/wl/wl-expire.el index 61b4931..e9f7add 100644 --- a/wl/wl-expire.el +++ b/wl/wl-expire.el @@ -455,12 +455,9 @@ Refile to archive folder followed message date." (wl-append deleted-list (car (wl-expire-delete folder dels)))) (setq delete-list (car tmp)) (while (setq msg (wl-pop delete-list)) - (setq date (elmo-time-make-date-string - (elmo-message-field folder msg 'date))) - (setq time - (condition-case nil - (timezone-fix-time date nil nil) - (error [0 0 0 0 0 0 0]))) + (setq time (or (elmo-time-to-datevec + (elmo-message-field folder msg 'date)) + (make-vector 7 0))) (if (= (aref time 1) 0) ;; if (month == 0) (aset time 0 0)) ;; year = 0 (setq dst-folder (format dst-folder-fmt @@ -540,12 +537,9 @@ ex. +ml/wl/1999_11/, +ml/wl/1999_12/." msg arcmsg-alist arcmsg-list deleted-list ret-val) (while (setq msg (wl-pop delete-list)) - (setq date (elmo-time-make-date-string - (elmo-message-field folder msg 'date))) - (setq time - (condition-case nil - (timezone-fix-time date nil nil) - (error [0 0 0 0 0 0 0]))) + (setq time (or (elmo-time-to-datevec + (elmo-message-field folder msg 'date)) + (make-vector 7 0))) (if (= (aref time 1) 0) ;; if (month == 0) (aset time 0 0)) ;; year = 0 (setq dst-folder (format dst-folder-fmt diff --git a/wl/wl-summary.el b/wl/wl-summary.el index d38308e..af3397a 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -3559,13 +3559,10 @@ Return non-nil if the mark is updated" wl-cached)) (elmo-mime-charset wl-summary-buffer-mime-charset) (elmo-lang wl-summary-buffer-weekday-name-lang) - (wl-datevec (or (ignore-errors - (timezone-fix-time - (elmo-time-make-date-string - (elmo-message-entity-field wl-message-entity 'date)) - nil - wl-summary-fix-timezone)) - (make-vector 5 0))) + (wl-datevec (or (elmo-time-to-datevec + (elmo-message-entity-field wl-message-entity 'date) + wl-summary-fix-timezone) + (make-vector 7 0))) (entity wl-message-entity) ; backward compatibility. line mark) (if (and wl-thr-indent-string