* nndoc.el (nndoc-type-alist): Improve regexp for article-begin,
authorKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 9 Jul 2004 09:45:45 +0000 (09:45 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 9 Jul 2004 09:45:45 +0000 (09:45 +0000)
 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
lisp/mm-decode.el
lisp/nndoc.el

index 79d568d..351a04c 100644 (file)
@@ -1,3 +1,13 @@
+2004-07-09  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * 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  <jdc@uwo.ca>
 
        * gnus-sum.el (gnus-summary-read-group-1): When summary
index 29c41c6..bfb7b6f 100644 (file)
@@ -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)))
index f34072b..076365a 100644 (file)
@@ -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 <larsi@gnus.org>
@@ -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)))