From 0861eb2e39d33c25cf8829af0e6a61557a7b8544 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 9 Sep 2011 10:18:45 +0000 Subject: [PATCH] gnus-art.el (article-date-ut): Work properly even when there are things like Date header in the body; work for forwarded parts. --- lisp/gnus/ChangeLog | 5 ++++ lisp/gnus/gnus-art.el | 61 +++++++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 2e0cc11279a..b989314557f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2011-09-09 Katsumi Yamaoka + + * gnus-art.el (article-date-ut): Work properly even when there are + things like Date header in the body; work for forwarded parts. + 2011-09-05 Andrew Cohen * gnus-sum.el (gnus-summary-exit): Ensure we kill the proper diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 9d962fc6d99..39abad7dae7 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3429,32 +3429,43 @@ possible values." (visible-date (mail-fetch-field "Date")) pos date bface eface) (save-excursion - (save-restriction - (goto-char (point-min)) - (when (re-search-forward "^Date:" nil t) - (setq bface (get-text-property (point-at-bol) 'face) - eface (get-text-property (1- (point-at-eol)) 'face))) - (goto-char (point-min)) - ;; Delete any old Date headers. - (if date-position - (progn - (goto-char date-position) - (setq date (get-text-property (point) 'original-date)) - (delete-region (point) - (progn - (gnus-article-forward-header) - (point))) + (goto-char (point-min)) + (when (re-search-forward "^Date:" nil t) + (setq bface (get-text-property (point-at-bol) 'face) + eface (get-text-property (1- (point-at-eol)) 'face))) + ;; Delete any old Date headers. + (if date-position + (progn + (goto-char date-position) + (setq date (get-text-property (point) 'original-date)) + (delete-region (point) + (progn + (gnus-article-forward-header) + (point))) + (article-transform-date date type bface eface)) + (save-restriction + (widen) + (goto-char (point-min)) + (while (or (get-text-property (setq pos (point)) 'original-date) + (and (setq pos (next-single-property-change + (point) 'original-date)) + (goto-char pos))) + (narrow-to-region pos (if (search-forward "\n\n" nil t) + (1+ (match-beginning 0)) + (point-max))) + (goto-char (point-min)) + (while (re-search-forward "^Date:" nil t) + (setq date (get-text-property (match-beginning 0) 'original-date)) + (delete-region (point-at-bol) (progn + (gnus-article-forward-header) + (point)))) + (when (and (not date) + visible-date) + (setq date visible-date)) + (when date (article-transform-date date type bface eface)) - (while (re-search-forward "^Date:" nil t) - (setq date (get-text-property (match-beginning 0) 'original-date)) - (delete-region (point-at-bol) (progn - (gnus-article-forward-header) - (point)))) - (when (and (not date) - visible-date) - (setq date visible-date)) - (when date - (article-transform-date date type bface eface))))))) + (goto-char (point-max)) + (widen))))))) (defun article-transform-date (date type bface eface) (dolist (this-type (cond -- 2.39.2