From f0a7b460b559b335a0b199c6915b1af7cf74a4aa Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 9 Jul 2004 09:45:45 +0000 Subject: [PATCH] * nndoc.el (nndoc-type-alist): Improve regexp for article-begin, add generate-head-function and generate-article-function to the rfc822-forward entry. (nndoc-rfc822-forward-generate-article): New function. (nndoc-rfc822-forward-generate-head): New function. * mm-decode.el (mm-dissect-buffer): Simplify cleaning of CTE. --- lisp/ChangeLog | 10 ++++++++++ lisp/mm-decode.el | 10 ++-------- lisp/nndoc.el | 31 ++++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 79d568dfd..351a04c1a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2004-07-09 Katsumi Yamaoka + + * nndoc.el (nndoc-type-alist): Improve regexp for article-begin, + add generate-head-function and generate-article-function to the + rfc822-forward entry. + (nndoc-rfc822-forward-generate-article): New function. + (nndoc-rfc822-forward-generate-head): New function. + + * mm-decode.el (mm-dissect-buffer): Simplify cleaning of CTE. + 2004-07-06 Dan Christensen * gnus-sum.el (gnus-summary-read-group-1): When summary diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 29c41c69b..bfb7b6f7d 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -522,15 +522,11 @@ Postpone undisplaying of viewers for types in ;; solution, avoids most of them. (if from (setq from (cadr (mail-extract-address-components from)))))) - (when cte - (setq cte (mail-header-strip cte))) (if (or (not ctl) (not (string-match "/" (car ctl)))) (mm-dissect-singlepart (list mm-dissect-default-type) - (and cte (intern (downcase (mail-header-remove-whitespace - (mail-header-remove-comments - cte))))) + (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (ignore-errors (mail-header-parse-content-disposition cd))) description) @@ -563,9 +559,7 @@ Postpone undisplaying of viewers for types in (mm-possibly-verify-or-decrypt (mm-dissect-singlepart ctl - (and cte (intern (downcase (mail-header-remove-whitespace - (mail-header-remove-comments - cte))))) + (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (ignore-errors (mail-header-parse-content-disposition cd))) diff --git a/lisp/nndoc.el b/lisp/nndoc.el index f34072b17..076365a8f 100644 --- a/lisp/nndoc.el +++ b/lisp/nndoc.el @@ -1,5 +1,5 @@ ;;; nndoc.el --- single file access for Gnus -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -130,8 +130,10 @@ from the document.") (article-transform-function . nndoc-transform-lanl-gov-announce) (subtype preprints guess)) (rfc822-forward - (article-begin . "^\n") - (body-end-function . nndoc-rfc822-forward-body-end-function)) + (article-begin . "^\n\n*") + (body-end-function . nndoc-rfc822-forward-body-end-function) + (generate-head-function . nndoc-rfc822-forward-generate-head) + (generate-article-function . nndoc-rfc822-forward-generate-article)) (outlook (article-begin-function . nndoc-outlook-article-begin) (body-end . "\0")) @@ -492,6 +494,29 @@ from the document.") (defun nndoc-rfc822-forward-body-end-function () (goto-char (point-max))) +(defun nndoc-rfc822-forward-generate-article (article &optional head) + (let ((entry (cdr (assq article nndoc-dissection-alist))) + (begin (point)) + encoding) + (with-current-buffer nndoc-current-buffer + (save-restriction + (message-narrow-to-head) + (setq encoding (message-fetch-field "content-transfer-encoding")))) + (insert-buffer-substring nndoc-current-buffer (car entry) (nth 3 entry)) + (when encoding + (save-restriction + (narrow-to-region begin (point-max)) + (mm-decode-content-transfer-encoding + (intern (downcase (mail-header-strip encoding)))))) + (when head + (goto-char begin) + (when (search-forward "\n\n" nil t) + (delete-region (1- (point)) (point-max))))) + t) + +(defun nndoc-rfc822-forward-generate-head (article) + (nndoc-rfc822-forward-generate-article article 'head)) + (defun nndoc-mime-parts-type-p () (let ((case-fold-search t) (limit (search-forward "\n\n" nil t))) -- 2.34.1