(gnus-article-date-value): Abolish.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 25 Apr 2005 07:22:34 +0000 (07:22 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 25 Apr 2005 07:22:34 +0000 (07:22 +0000)
(gnus-article-save-original-date): Redefine it as a macro.
(gnus-display-mime): Use it.

lisp/ChangeLog
lisp/gnus-art.el

index 9bf7778..3af5f3b 100644 (file)
@@ -3,10 +3,8 @@
        * gnus-art.el (article-date-ut): Don't delete X-Sent header when
        gnus-article-date-lapsed-new-header is t if date timer is active;
        skip headers in which the original date value is empty.
-       (gnus-article-date-value): New function.
-       (gnus-article-save-original-date): Abolish.
-       (gnus-display-mime): Save original date after doing all treatments
-       as well.
+       (gnus-article-save-original-date): Redefine it as a macro.
+       (gnus-display-mime): Use it.
 
 2005-04-22  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index e7741e0..0a81979 100644 (file)
@@ -3119,17 +3119,26 @@ This format is defined by the `gnus-article-time-format' variable."
   (interactive (list t))
   (article-date-ut 'iso8601 highlight))
 
-(defun gnus-article-date-value ()
-  "Return the value of the date header.
-The buffer is expected to be narrowed to just the header of the article."
-  (goto-char (point-min))
-  (let* ((case-fold-search t)
-        (start (when (and (re-search-forward "^date:[\t\n ]+" nil t)
-                          (not (bolp)))
-                 (match-end 0))))
-    (when (and start
-              (re-search-forward "[\t ]*\n\\(?:[^\t ]\\|\\'\\)" nil t))
-      (buffer-substring-no-properties start (match-beginning 0)))))
+(defmacro gnus-article-save-original-date (&rest forms)
+  "Save the original date as a text property and evaluate FORMS."
+  `(let* ((case-fold-search t)
+         (start (progn
+                  (goto-char (point-min))
+                  (when (and (re-search-forward "^date:[\t\n ]+" nil t)
+                             (not (bolp)))
+                    (match-end 0))))
+         (date (when (and start
+                          (re-search-forward "[\t ]*\n\\(?:[^\t ]\\|\\'\\)"
+                                             nil t))
+                 (buffer-substring-no-properties start
+                                                 (match-beginning 0)))))
+     (goto-char (point-max))
+     (skip-chars-backward "\n")
+     (put-text-property (point-min) (point) 'original-date date)
+     ,@forms
+     (goto-char (point-max))
+     (skip-chars-backward "\n")
+     (put-text-property (point-min) (point) 'original-date date)))
 
 ;; (defun article-show-all ()
 ;;   "Show all hidden text in the article buffer."
@@ -4707,16 +4716,8 @@ N is the numerical prefix."
            (save-restriction
              (article-goto-body)
              (narrow-to-region (point-min) (point))
-             (setq date (gnus-article-date-value))
-             (goto-char (point-max))
-             (skip-chars-backward "\n")
-             (put-text-property (point-min) (point)
-                                'original-date date)
-             (gnus-treat-article 'head)
-             (goto-char (point-max))
-             (skip-chars-backward "\n")
-             (put-text-property (point-min) (point)
-                                'original-date date))))))))
+             (gnus-article-save-original-date
+              (gnus-treat-article 'head)))))))))
 
 (defcustom gnus-mime-display-multipart-as-mixed nil
   "Display \"multipart\" parts as  \"multipart/mixed\".