summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-art.el
diff options
context:
space:
mode:
authorKatsumi Yamaoka <yamaoka@jpl.org>2011-09-09 10:18:45 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-09-09 10:18:45 +0000
commit0861eb2e39d33c25cf8829af0e6a61557a7b8544 (patch)
treef4eab818d63e3cc1b620f5f18b91c0922ef9cce2 /lisp/gnus/gnus-art.el
parent0a6b9622809567f221feaf78adc69f62efeb622d (diff)
downloademacs-0861eb2e39d33c25cf8829af0e6a61557a7b8544.tar.gz
gnus-art.el (article-date-ut): Work properly even when
there are things like Date header in the body; work for forwarded parts.
Diffstat (limited to 'lisp/gnus/gnus-art.el')
-rw-r--r--lisp/gnus/gnus-art.el61
1 files changed, 36 insertions, 25 deletions
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