Created
November 6, 2015 05:40
-
-
Save peccu/a9e5611e4e6d4a9be281 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-folder (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-folder (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))) |
大変便利です。emacs-27.2 にして気づいたのですが、timezone.el を require する必要があるようです。
(require 'timezone)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これを参考に mew の環境を整えました。ありがとうございます。
使っていてバグに気付きました。
(mew-expand-folder (MEW-FLD) (MEW-NUM)) が2箇所ありますが、これは
(mew-expand-msg (MEW-FLD) (MEW-NUM)) の間違いだと思います。