Forked from peccu/mew-summary-form-considering-timezone.el
Last active
October 11, 2018 07:13
-
-
Save yuichish/65bb10bd7fd96c4cd0b91b3afc4f6c0e to your computer and use it in GitHub Desktop.
Mewのサマリモードで、タイムゾーンを考慮した日時を表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; mew summary date/time considering timezone | |
;; http://permalink.gmane.org/gmane.mail.mew.general.japanese/2355 | |
(defun mew-summary-form-time-z () | |
"A function to return a message time, HH:MM" | |
(let ((s (MEW-DATE))) | |
(setq s (timezone-make-date-arpa-standard | |
(if (or (string= s "") | |
(not (string-match mew-time-rfc-regex s))) | |
(mew-time-ctz-to-rfc | |
(mew-file-get-time (mew-expand-msg (MEW-FLD) (MEW-NUM)))) | |
s))) | |
(if (string-match mew-time-rfc-regex s) | |
(format "%02d:%02d" | |
(or (mew-time-rfc-hour) 0) | |
(or (mew-time-rfc-min) 0)) | |
"00:00"))) | |
(defun mew-summary-form-date-z () | |
"A function to return a date, MM/DD." | |
(let ((s (MEW-DATE))) | |
(setq s (timezone-make-date-arpa-standard | |
(if (or (string= s "") | |
(not (string-match mew-time-rfc-regex s))) | |
(mew-time-ctz-to-rfc | |
(mew-file-get-time (mew-expand-msg (MEW-FLD) (MEW-NUM)))) | |
s))) | |
(if (string-match mew-time-rfc-regex s) | |
(format "%02d/%02d" | |
(mew-time-mon-str-to-int (mew-time-rfc-mon)) | |
(mew-time-rfc-day)) | |
""))) | |
(defun mew-summary-form-time-zone () | |
"A function to return a message date timezone, +ZZZZ." | |
(let ((s (MEW-DATE))) | |
(when (or (string= s "") | |
(not (string-match mew-time-rfc-regex s))) | |
(setq s (mew-time-ctz-to-rfc | |
(mew-file-get-time (mew-expand-msg (MEW-FLD) (MEW-NUM)))))) | |
(if (string-match mew-time-rfc-regex s) | |
(format "%05s" | |
(if (match-beginning 9) | |
(let ((tmzn (substring s (match-beginning 9) (match-end 9))) | |
int) | |
(cond | |
((string-match "^[-+][0-9]+$" tmzn) | |
tmzn) | |
((setq int (mew-time-tmzn-str-to-int tmzn)) | |
(format "%s00" int)) | |
(t "+????"))) | |
"+????")) | |
"+????"))) | |
;; use above | |
;; (setq mew-summary-form '(type (4 year) "/" (5 date-z) " " (5 time-z) "(" (5 time-zone) ") " (60 from) "|" t (0 subj))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment