diff options
| author | Lars Ingebrigtsen | 2011-01-31 07:27:07 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-01-31 07:27:07 +0000 |
| commit | 32a400d4e1493022442ff76761c24924937e7dad (patch) | |
| tree | 1fe7ae4ba8c641c3c754d372a664f16485c4df03 | |
| parent | 3370edca839da739185a7a0d91d22dfa23a22188 (diff) | |
| download | emacs-32a400d4e1493022442ff76761c24924937e7dad.tar.gz emacs-32a400d4e1493022442ff76761c24924937e7dad.zip | |
gnus-art.el (article-transform-date): Rewrite to still work when there are several rfc2822 parts.
| -rw-r--r-- | lisp/gnus/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 98 |
2 files changed, 46 insertions, 55 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 8e3db59710c..ffb19c8bc59 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-01-31 Lars Ingebrigtsen <larsi@gnus.org> | 1 | 2011-01-31 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * gnus-art.el (article-transform-date): Rewrite to still work when | ||
| 4 | there are several rfc2822 parts. | ||
| 5 | |||
| 3 | * nnimap.el (nnimap-wait-for-response): Wait for results in a more | 6 | * nnimap.el (nnimap-wait-for-response): Wait for results in a more |
| 4 | secure manner. | 7 | secure manner. |
| 5 | 8 | ||
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 0fdd6bd2880..5d32c097663 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -3420,62 +3420,50 @@ possible values." | |||
| 3420 | pos date bface eface) | 3420 | pos date bface eface) |
| 3421 | (save-excursion | 3421 | (save-excursion |
| 3422 | (save-restriction | 3422 | (save-restriction |
| 3423 | (widen) | ||
| 3424 | (goto-char (point-min)) | 3423 | (goto-char (point-min)) |
| 3425 | (while (or (setq date (get-text-property (setq pos (point)) | 3424 | (when (re-search-forward "^Date:" nil t) |
| 3426 | 'original-date)) | 3425 | (setq bface (get-text-property (point-at-bol) 'face) |
| 3427 | (when (setq pos (next-single-property-change | 3426 | eface (get-text-property (1- (point-at-eol)) 'face))) |
| 3428 | (point) 'original-date)) | 3427 | (goto-char (point-min)) |
| 3429 | (setq date (get-text-property pos 'original-date)) | 3428 | ;; Delete any old Date headers. |
| 3430 | t)) | 3429 | (if date-position |
| 3431 | (narrow-to-region | 3430 | (progn |
| 3432 | pos (if (setq pos (text-property-any pos (point-max) | 3431 | (goto-char date-position) |
| 3433 | 'original-date nil)) | 3432 | (setq date (get-text-property (point) 'original-date)) |
| 3434 | (progn | 3433 | (delete-region (point) |
| 3435 | (goto-char pos) | 3434 | (progn |
| 3436 | (if (or (bolp) (eobp)) | 3435 | (gnus-article-forward-header) |
| 3437 | (point) | 3436 | (point))) |
| 3438 | (1+ (point)))) | 3437 | (article-transform-date date type bface eface)) |
| 3439 | (point-max))) | 3438 | (while (re-search-forward "^Date:" nil t) |
| 3440 | (goto-char (point-min)) | 3439 | (setq date (get-text-property (match-beginning 0) 'original-date)) |
| 3441 | (when (re-search-forward "^Date:" nil t) | 3440 | (delete-region (point-at-bol) (progn |
| 3442 | (setq bface (get-text-property (point-at-bol) 'face) | 3441 | (gnus-article-forward-header) |
| 3443 | eface (get-text-property (1- (point-at-eol)) 'face))) | 3442 | (point))) |
| 3444 | (goto-char (point-min)) | 3443 | (article-transform-date date type bface eface) |
| 3445 | ;; Delete any old Date headers. | 3444 | (forward-line 1))))))) |
| 3446 | (if date-position | 3445 | |
| 3447 | (progn | 3446 | (defun article-transform-date (date type bface eface) |
| 3448 | (goto-char date-position) | 3447 | (dolist (this-type (cond |
| 3449 | (delete-region (point) | 3448 | ((null type) |
| 3450 | (progn | 3449 | (list 'ut)) |
| 3451 | (gnus-article-forward-header) | 3450 | ((atom type) |
| 3452 | (point)))) | 3451 | (list type)) |
| 3453 | (while (re-search-forward "^Date:" nil t) | 3452 | (t |
| 3454 | (delete-region (point-at-bol) (progn | 3453 | type))) |
| 3455 | (gnus-article-forward-header) | 3454 | (insert (article-make-date-line date (or this-type 'ut)) "\n") |
| 3456 | (point))))) | 3455 | (forward-line -1) |
| 3457 | (dolist (this-type (cond | 3456 | (beginning-of-line) |
| 3458 | ((null type) | 3457 | (put-text-property (point) (1+ (point)) |
| 3459 | (list 'ut)) | 3458 | 'original-date date) |
| 3460 | ((atom type) | 3459 | (put-text-property (point) (1+ (point)) |
| 3461 | (list type)) | 3460 | 'gnus-date-type this-type) |
| 3462 | (t | 3461 | ;; Do highlighting. |
| 3463 | type))) | 3462 | (when (looking-at "\\([^:]+\\): *\\(.*\\)$") |
| 3464 | (insert (article-make-date-line date (or this-type 'ut)) "\n") | 3463 | (put-text-property (match-beginning 1) (1+ (match-end 1)) |
| 3465 | (forward-line -1) | 3464 | 'face bface) |
| 3466 | (put-text-property (line-beginning-position) | 3465 | (put-text-property (match-beginning 2) (match-end 2) |
| 3467 | (1+ (line-beginning-position)) | 3466 | 'face eface)))) |
| 3468 | 'gnus-date-type this-type) | ||
| 3469 | ;; Do highlighting. | ||
| 3470 | (beginning-of-line) | ||
| 3471 | (when (looking-at "\\([^:]+\\): *\\(.*\\)$") | ||
| 3472 | (put-text-property (match-beginning 1) (1+ (match-end 1)) | ||
| 3473 | 'face bface) | ||
| 3474 | (put-text-property (match-beginning 2) (match-end 2) | ||
| 3475 | 'face eface))) | ||
| 3476 | (put-text-property (point-min) (1- (point-max)) 'original-date date) | ||
| 3477 | (goto-char (point-max)) | ||
| 3478 | (widen)))))) | ||
| 3479 | 3467 | ||
| 3480 | (defun article-make-date-line (date type) | 3468 | (defun article-make-date-line (date type) |
| 3481 | "Return a DATE line of TYPE." | 3469 | "Return a DATE line of TYPE." |