Browse Source

Define properties for date header field

* org-wl.el (org-wl-store-link-message): Define properties %:date,
%:date-timestamp, and %:date-timestamp-inactive.
* org-mew.el (org-mew-store-link): Dto.
* org-mhe.el (org-mhe-store-link): Dto.
* org-rmail.el (org-rmail-store-link): Dto.
* org-vm.el (org-vm-store-link): Dto.
David Maus 10 years ago
parent
commit
85c78e5688
5 changed files with 55 additions and 6 deletions
  1. 11 1
      lisp/org-mew.el
  2. 14 5
      lisp/org-mhe.el
  3. 10 0
      lisp/org-rmail.el
  4. 10 0
      lisp/org-vm.el
  5. 10 0
      lisp/org-wl.el

+ 11 - 1
lisp/org-mew.el

@@ -81,7 +81,7 @@
 		(mew-case-folder (mew-sinfo-get-case)
 				 (nth 1 (mew-refile-get msgnum)))
 	      (mew-summary-folder-name)))
-	   message-id from to subject desc link)
+	   message-id from to subject desc link date date-ts date-ts-ia)
       (save-window-excursion
 	(if (fboundp 'mew-summary-set-message-buffer)
 	    (mew-summary-set-message-buffer folder-name msgnum)
@@ -89,9 +89,19 @@
 	(setq message-id (mew-header-get-value "Message-Id:"))
 	(setq from (mew-header-get-value "From:"))
 	(setq to (mew-header-get-value "To:"))
+	(setq date (mew-header-get-value "Date:"))
+	(setq date-ts (and date (format-time-string
+				 (org-time-stamp-format t)
+				 (date-to-time date))))
+	(setq date-ts-ia (and date (format-time-string
+				    (org-time-stamp-format t t)
+				    (date-to-time date))))
 	(setq subject (mew-header-get-value "Subject:")))
       (org-store-link-props :type "mew" :from from :to to
 			    :subject subject :message-id message-id)
+      (when date
+	(org-add-link-props :date date :date-timestamp date-ts
+			    :date-timestamp-inactive date-ts-ia))
       (setq message-id (org-remove-angle-brackets message-id))
       (setq desc (org-email-link-description))
       (setq link (org-make-link "mew:" folder-name

+ 14 - 5
lisp/org-mhe.el

@@ -83,13 +83,22 @@ supported by MH-E."
   "Store a link to an MH-E folder or message."
   (when (or (equal major-mode 'mh-folder-mode)
 	    (equal major-mode 'mh-show-mode))
-    (let ((from (org-mhe-get-header "From:"))
-	  (to (org-mhe-get-header "To:"))
-	  (message-id (org-mhe-get-header "Message-Id:"))
-	  (subject (org-mhe-get-header "Subject:"))
-	  link desc)
+    (let* ((from (org-mhe-get-header "From:"))
+	   (to (org-mhe-get-header "To:"))
+	   (message-id (org-mhe-get-header "Message-Id:"))
+	   (subject (org-mhe-get-header "Subject:"))
+	   (date (org-mhe-get-header "Date:"))
+	   (date-ts (and date (format-time-string
+			       (org-time-stamp-format t) (date-to-time date))))
+	   (date-ts-ia (and date (format-time-string
+				  (org-time-stamp-format t t)
+				  (date-to-time date))))
+	   link desc)
       (org-store-link-props :type "mh" :from from :to to
 			    :subject subject :message-id message-id)
+      (when date
+	(org-add-link-props :date date :date-timestamp date-ts
+			    :date-timestamp-inactive date-ts-ia))
       (setq desc (org-email-link-description))
       (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
 				(org-remove-angle-brackets message-id)))

+ 10 - 0
lisp/org-rmail.el

@@ -59,10 +59,20 @@
 	       (from (mail-fetch-field "from"))
 	       (to (mail-fetch-field "to"))
 	       (subject (mail-fetch-field "subject"))
+	       (date (mail-fetch-field "date"))
+	       (date-ts (and date (format-time-string
+				   (org-time-stamp-format t)
+				   (date-to-time date))))
+	       (date-ts-ia (and date (format-time-string
+				      (org-time-stamp-format t t)
+				      (date-to-time date))))
 	       desc link)
 	  (org-store-link-props
 	   :type "rmail" :from from :to to
 	   :subject subject :message-id message-id)
+	  (when date
+	    (org-add-link-props :date date :date-timestamp date-ts
+				:date-timestamp-inactive date-ts-ia))
 	  (setq message-id (org-remove-angle-brackets message-id))
 	  (setq desc (org-email-link-description))
 	  (setq link (org-make-link "rmail:" folder "#" message-id))

+ 10 - 0
lisp/org-vm.el

@@ -66,9 +66,19 @@
 	     (to (vm-get-header-contents message "To"))
 	     (from (vm-get-header-contents message "From"))
 	     (message-id (vm-su-message-id message))
+	     (date (vm-get-header-contents message "Date"))
+	     (date-ts (and date (format-time-string
+				 (org-time-stamp-format t)
+				 (date-to-time date))))
+	     (date-ts-ia (and date (format-time-string
+				    (org-time-stamp-format t t)
+				    (date-to-time date))))
 	     desc link)
 	(org-store-link-props :type "vm" :from from :to to :subject subject
 			      :message-id message-id)
+	(when date
+	  (org-add-link-props :date date :date-timestamp date-ts
+			      :date-timestamp-inactive date-ts-ia))
 	(setq message-id (org-remove-angle-brackets message-id))
 	(setq folder (abbreviate-file-name folder))
 	(if (and vm-folder-directory

+ 10 - 0
lisp/org-wl.el

@@ -199,6 +199,13 @@ ENTITY is a message entity."
 		 (to (org-wl-message-field 'to wl-message-entity))
 		 (xref (org-wl-message-field 'xref wl-message-entity))
 		 (subject (org-wl-message-field 'subject wl-message-entity))
+		 (date (org-wl-message-field 'date wl-message-entity))
+		 (date-ts (and date (format-time-string
+				     (org-time-stamp-format t)
+				     (date-to-time date))))
+		 (date-ts-ia (and date (format-time-string
+					(org-time-stamp-format t t)
+					(date-to-time date))))
 		 desc link)
 
 	    ;; remove text properties of subject string to avoid possible bug
@@ -238,6 +245,9 @@ ENTITY is a message entity."
 	      (setq desc (org-email-link-description))
 	      (setq link (org-make-link "wl:" folder-name "#" message-id-no-brackets))
 	      (org-add-link-props :link link :description desc)))
+	    (when date
+	      (org-add-link-props :date date :date-timestamp date-ts
+				  :date-timestamp-inactive date-ts-ia))
 	    (or link xref)))))))
 
 (defun org-wl-open-nntp (path)