annotate lisp/gnus/nndoc.el @ 112172:7bdc1e5a82a9

Add definition for `dired-directory' face.
author Tassilo Horn <tassilo@member.fsf.org>
date Sun, 09 Jan 2011 18:49:25 +0100
parents 3d7a1caabf14
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 ;;; nndoc.el --- single file access for Gnus
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
2
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
7 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8 ;; Keywords: news
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
11
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92432
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92432
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92432
diff changeset
15 ;; (at your option) any later version.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
21
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 92432
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
24
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25 ;;; Commentary:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
27 ;; For Outlook mail boxes format, see http://mbx2mbox.sourceforge.net/
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
28
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
29 ;;; Code:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
30
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
31 (require 'nnheader)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
32 (require 'message)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
33 (require 'nnmail)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
34 (require 'nnoo)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
35 (require 'gnus-util)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
36 (require 'mm-util)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
37 (eval-when-compile (require 'cl))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
38
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
39 (nnoo-declare nndoc)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
40
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
41 (defvoo nndoc-article-type 'guess
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
42 "*Type of the file.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
43 One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
44 `rfc934', `rfc822-forward', `mime-parts', `standard-digest',
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
45 `slack-digest', `clari-briefs', `nsmail', `outlook', `oe-dbx',
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
46 `mailman', `exim-bounce', or `guess'.")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
47
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
48 (defvoo nndoc-post-type 'mail
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
49 "*Whether the nndoc group is `mail' or `post'.")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
50
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
51 (defvoo nndoc-open-document-hook 'nnheader-ms-strip-cr
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
52 "Hook run after opening a document.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
53 The default function removes all trailing carriage returns
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
54 from the document.")
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
55
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
56 (defvar nndoc-type-alist
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
57 `((mmdf
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
58 (article-begin . "^\^A\^A\^A\^A\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
59 (body-end . "^\^A\^A\^A\^A\n"))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
60 (mime-digest
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
61 (article-begin . "")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
62 (head-begin . "^ ?\n")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
63 (head-end . "^ ?$")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
64 (body-end . "")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
65 (file-end . "")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
66 (subtype digest guess))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
67 (nsmail
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
68 (article-begin . "^From - "))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
69 (news
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
70 (article-begin . "^Path:"))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
71 (rnews
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
72 (article-begin . "^#! *rnews +\\([0-9]+\\) *\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
73 (body-end-function . nndoc-rnews-body-end))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
74 (mbox
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
75 (article-begin-function . nndoc-mbox-article-begin)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
76 (body-end-function . nndoc-mbox-body-end))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
77 (babyl
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
78 (article-begin . "\^_\^L *\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
79 (body-end . "\^_")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
80 (body-begin-function . nndoc-babyl-body-begin)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
81 (head-begin-function . nndoc-babyl-head-begin))
110689
42815c76b976 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
82 (mime-parts
42815c76b976 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
83 (generate-head-function . nndoc-generate-mime-parts-head)
42815c76b976 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110661
diff changeset
84 (article-transform-function . nndoc-transform-mime-parts))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
85 (exim-bounce
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
86 (article-begin . "^------ This is a copy of the message, including all the headers. ------\n\n")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
87 (body-end-function . nndoc-exim-bounce-body-end-function))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
88 (rfc934
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
89 (article-begin . "^--.*\n+")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
90 (body-end . "^--.*$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
91 (prepare-body-function . nndoc-unquote-dashes))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
92 (mailman
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
93 (article-begin . "^--__--__--\n\nMessage:")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
94 (body-end . "^--__--__--$")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
95 (prepare-body-function . nndoc-unquote-dashes))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
96 (clari-briefs
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
97 (article-begin . "^ \\*")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
98 (body-end . "^\t------*[ \t]^*\n^ \\*")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
99 (body-begin . "^\t")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
100 (head-end . "^\t")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
101 (generate-head-function . nndoc-generate-clari-briefs-head)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
102 (article-transform-function . nndoc-transform-clari-briefs))
110111
5b9f64b04a04 Delete all trailing white space.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110108
diff changeset
103
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
104 (standard-digest
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
105 (first-article . ,(concat "^" (make-string 70 ?-) "\n *\n+"))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
106 (article-begin . ,(concat "^\n" (make-string 30 ?-) "\n *\n+"))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
107 (prepare-body-function . nndoc-unquote-dashes)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
108 (body-end-function . nndoc-digest-body-end)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
109 (head-end . "^ *$")
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
110 (body-begin . "^ *\n")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
111 (file-end . "^End of .*digest.*[0-9].*\n\\*\\*\\|^End of.*Digest *$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
112 (subtype digest guess))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
113 (slack-digest
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
114 (article-begin . "^------------------------------*[\n \t]+")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
115 (head-end . "^ ?$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
116 (body-end-function . nndoc-digest-body-end)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
117 (body-begin . "^ ?$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
118 (file-end . "^End of")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
119 (prepare-body-function . nndoc-unquote-dashes)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
120 (subtype digest guess))
110108
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
121 (google
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
122 (pre-dissection-function . nndoc-decode-content-transfer-encoding)
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
123 (article-begin . "^== [0-9]+ of [0-9]+ ==$")
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
124 (head-begin . "^Date:")
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
125 (head-end . "^$")
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
126 (body-end-function . nndoc-digest-body-end)
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
127 (body-begin . "^$")
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
128 (file-end . "^==============================================================================$")
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
129 (prepare-body-function . nndoc-unquote-dashes)
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
130 (subtype digest guess))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
131 (lanl-gov-announce
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
132 (article-begin . "^\\\\\\\\\n")
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
133 (head-begin . "^\\(Paper.*:\\|arXiv:\\)")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
134 (head-end . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
135 (body-begin . "")
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
136 (body-end . "\\(-------------------------------------------------\\|%-%-%-%-%-%-%-%-%-%-%-%-%-%-\\|%%--%%--%%--%%--%%--%%--%%--%%--\\|%%%---%%%---%%%---%%%---\\)")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
137 (file-end . "\\(^Title: Recent Seminal\\|%%%---%%%---%%%---%%%---\\)")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
138 (generate-head-function . nndoc-generate-lanl-gov-head)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
139 (article-transform-function . nndoc-transform-lanl-gov-announce)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
140 (subtype preprints guess))
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
141 (git
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
142 (file-begin . "\n- Log ---.*")
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
143 (article-begin . "^commit ")
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
144 (head-begin . "^Author: ")
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
145 (body-begin . "^$")
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
146 (file-end . "\n-----------------------------------------------------------------------")
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
147 (article-transform-function . nndoc-transform-git-article)
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
148 (header-transform-function . nndoc-transform-git-headers))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
149 (rfc822-forward
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
150 (article-begin . "^\n+")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
151 (body-end-function . nndoc-rfc822-forward-body-end-function)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
152 (generate-head-function . nndoc-rfc822-forward-generate-head)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
153 (generate-article-function . nndoc-rfc822-forward-generate-article))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
154 (outlook
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
155 (article-begin-function . nndoc-outlook-article-begin)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
156 (body-end . "\0"))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
157 (oe-dbx ;; Outlook Express DBX format
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
158 (dissection-function . nndoc-oe-dbx-dissection)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
159 (generate-head-function . nndoc-oe-dbx-generate-head)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
160 (generate-article-function . nndoc-oe-dbx-generate-article))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
161 (forward
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
162 (article-begin . "^-+ \\(Start of \\)?forwarded message.*\n+")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
163 (body-end . "^-+ End \\(of \\)?forwarded message.*$")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
164 (prepare-body-function . nndoc-unquote-dashes))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
165 (mail-in-mail ;; Wild guess on mailer daemon's messages or others
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
166 (article-begin-function . nndoc-mail-in-mail-article-begin))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
167 (guess
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
168 (guess . t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
169 (subtype nil))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
170 (digest
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
171 (guess . t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
172 (subtype nil))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
173 (preprints
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
174 (guess . t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
175 (subtype nil))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
176
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
177 (defvar nndoc-binary-file-names ".[Dd][Bb][Xx]$"
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
178 "Regexp for binary nndoc file names.")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
179
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
180
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
181 (defvoo nndoc-file-begin nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
182 (defvoo nndoc-first-article nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
183 (defvoo nndoc-article-begin nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
184 (defvoo nndoc-head-begin nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
185 (defvoo nndoc-head-end nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
186 (defvoo nndoc-file-end nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
187 (defvoo nndoc-body-begin nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
188 (defvoo nndoc-body-end-function nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
189 (defvoo nndoc-body-begin-function nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
190 (defvoo nndoc-head-begin-function nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
191 (defvoo nndoc-body-end nil)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
192 ;; nndoc-dissection-alist is a list of sublists. Each sublist holds the
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
193 ;; following items. ARTICLE acts as the association key and is an ordinal
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
194 ;; starting at 1. HEAD-BEGIN [0], HEAD-END [1], BODY-BEGIN [2] and BODY-END
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
195 ;; [3] are positions in the `nndoc' buffer. LINE-COUNT [4] is a count of
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
196 ;; lines in the body. For MIME dissections only, ARTICLE-INSERT [5] and
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
197 ;; SUMMARY-INSERT [6] give headers to insert for full article or summary line
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
198 ;; generation, respectively. Other headers usually follow directly from the
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
199 ;; buffer. Value `nil' means no insert.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
200 (defvoo nndoc-dissection-alist nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
201 (defvoo nndoc-prepare-body-function nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
202 (defvoo nndoc-generate-head-function nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
203 (defvoo nndoc-article-transform-function nil)
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
204 (defvoo nndoc-header-transform-function nil)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
205 (defvoo nndoc-article-begin-function nil)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
206 (defvoo nndoc-generate-article-function nil)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
207 (defvoo nndoc-dissection-function nil)
110108
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
208 (defvoo nndoc-pre-dissection-function nil)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
209
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
210 (defvoo nndoc-status-string "")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
211 (defvoo nndoc-group-alist nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
212 (defvoo nndoc-current-buffer nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
213 "Current nndoc news buffer.")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
214 (defvoo nndoc-address nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
215
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
216 (defconst nndoc-version "nndoc 1.0"
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
217 "nndoc version.")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
218
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
219
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
220
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
221 ;;; Interface functions
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
222
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
223 (nnoo-define-basics nndoc)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
224
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
225 (deffoo nndoc-retrieve-headers (articles &optional newsgroup server fetch-old)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
226 (when (nndoc-possibly-change-buffer newsgroup server)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
227 (with-current-buffer nntp-server-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
228 (erase-buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
229 (let (article entry)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
230 (if (stringp (car articles))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
231 'headers
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
232 (while articles
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
233 (when (setq entry (cdr (assq (setq article (pop articles))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
234 nndoc-dissection-alist)))
111056
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
235 (let ((start (point)))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
236 (insert (format "221 %d Article retrieved.\n" article))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
237 (if nndoc-generate-head-function
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
238 (funcall nndoc-generate-head-function article)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
239 (insert-buffer-substring
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
240 nndoc-current-buffer (car entry) (nth 1 entry)))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
241 (goto-char (point-max))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
242 (unless (eq (char-after (1- (point))) ?\n)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
243 (insert "\n"))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
244 (insert (format "Lines: %d\n" (nth 4 entry)))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
245 (insert ".\n")
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
246 (when nndoc-header-transform-function
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
247 (save-excursion
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
248 (save-restriction
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
249 (narrow-to-region start (point))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
250 (funcall nndoc-header-transform-function entry)))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
251 (nnheader-fold-continuation-lines)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
252 'headers)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
253
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
254 (deffoo nndoc-request-article (article &optional newsgroup server buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
255 (nndoc-possibly-change-buffer newsgroup server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
256 (save-excursion
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
257 (let ((buffer (or buffer nntp-server-buffer))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
258 (entry (cdr (assq article nndoc-dissection-alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
259 beg)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
260 (set-buffer buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
261 (erase-buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
262 (when entry
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
263 (cond
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
264 ((stringp article) nil)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
265 (nndoc-generate-article-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
266 (funcall nndoc-generate-article-function article))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
267 (t
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
268 (insert-buffer-substring
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
269 nndoc-current-buffer (car entry) (nth 1 entry))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
270 (insert "\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
271 (setq beg (point))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
272 (insert-buffer-substring
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
273 nndoc-current-buffer (nth 2 entry) (nth 3 entry))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
274 (goto-char beg)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
275 (when nndoc-prepare-body-function
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
276 (funcall nndoc-prepare-body-function))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
277 (when nndoc-article-transform-function
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
278 (funcall nndoc-article-transform-function article))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
279 t))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
280
110422
93e093c035a0 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110410
diff changeset
281 (deffoo nndoc-request-group (group &optional server dont-check info)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
282 "Select news GROUP."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
283 (let (number)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
284 (cond
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
285 ((not (nndoc-possibly-change-buffer group server))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
286 (nnheader-report 'nndoc "No such file or buffer: %s"
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
287 nndoc-address))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
288 (dont-check
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
289 (nnheader-report 'nndoc "Selected group %s" group)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
290 t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
291 ((zerop (setq number (length nndoc-dissection-alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
292 (nndoc-close-group group)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
293 (nnheader-report 'nndoc "No articles in group %s" group))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
294 (t
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
295 (nnheader-insert "211 %d %d %d %s\n" number 1 number group)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
296
110661
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110596
diff changeset
297 (deffoo nndoc-retrieve-groups (groups &optional server)
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110596
diff changeset
298 (dolist (group groups)
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110596
diff changeset
299 (nndoc-request-group group server))
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110596
diff changeset
300 t)
2b8ece636433 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110596
diff changeset
301
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
302 (deffoo nndoc-request-type (group &optional article)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
303 (cond ((not article) 'unknown)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
304 (nndoc-post-type nndoc-post-type)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
305 (t 'unknown)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
306
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
307 (deffoo nndoc-close-group (group &optional server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
308 (nndoc-possibly-change-buffer group server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
309 (and nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
310 (buffer-name nndoc-current-buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
311 (kill-buffer nndoc-current-buffer))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
312 (setq nndoc-group-alist (delq (assoc group nndoc-group-alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
313 nndoc-group-alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
314 (setq nndoc-current-buffer nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
315 (nnoo-close-server 'nndoc server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
316 (setq nndoc-dissection-alist nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
317 t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
318
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
319 (deffoo nndoc-request-list (&optional server)
110596
415e87a42437 mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110583
diff changeset
320 t)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
321
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
322 (deffoo nndoc-request-newgroups (date &optional server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
323 nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
324
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
325 (deffoo nndoc-request-list-newsgroups (&optional server)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
326 nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
327
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
328
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
329 ;;; Internal functions.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
330
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
331 (defun nndoc-possibly-change-buffer (group source)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
332 (let (buf)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
333 (cond
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
334 ;; The current buffer is this group's buffer.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
335 ((and nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
336 (buffer-name nndoc-current-buffer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
337 (eq nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
338 (setq buf (cdr (assoc group nndoc-group-alist))))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
339 ;; We change buffers by taking an old from the group alist.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
340 ;; `source' is either a string (a file name) or a buffer object.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
341 (buf
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
342 (setq nndoc-current-buffer buf))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
343 ;; It's a totally new group.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
344 ((or (and (bufferp nndoc-address)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
345 (buffer-name nndoc-address))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
346 (and (stringp nndoc-address)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
347 (file-exists-p nndoc-address)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
348 (not (file-directory-p nndoc-address))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
349 (push (cons group (setq nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
350 (get-buffer-create
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
351 (concat " *nndoc " group "*"))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
352 nndoc-group-alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
353 (setq nndoc-dissection-alist nil)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
354 (with-current-buffer nndoc-current-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
355 (erase-buffer)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
356 (if (and (stringp nndoc-address)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
357 (string-match nndoc-binary-file-names nndoc-address))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
358 (let ((coding-system-for-read 'binary))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
359 (mm-insert-file-contents nndoc-address))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
360 (if (stringp nndoc-address)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
361 (nnheader-insert-file-contents nndoc-address)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
362 (insert-buffer-substring nndoc-address))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
363 (run-hooks 'nndoc-open-document-hook)))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
364 ;; Initialize the nndoc structures according to this new document.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
365 (when (and nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
366 (not nndoc-dissection-alist))
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
367 (with-current-buffer nndoc-current-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
368 (nndoc-set-delims)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
369 (if (eq nndoc-article-type 'mime-parts)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
370 (nndoc-dissect-mime-parts)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
371 (nndoc-dissect-buffer))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
372 (unless nndoc-current-buffer
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
373 (nndoc-close-server))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
374 ;; Return whether we managed to select a file.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
375 nndoc-current-buffer))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
376
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
377 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
378 ;;; Deciding what document type we have
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
379 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
380
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
381 (defun nndoc-set-delims ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
382 "Set the nndoc delimiter variables according to the type of the document."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
383 (let ((vars '(nndoc-file-begin
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
384 nndoc-first-article
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
385 nndoc-article-begin-function
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
386 nndoc-head-begin nndoc-head-end
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
387 nndoc-file-end nndoc-article-begin
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
388 nndoc-body-begin nndoc-body-end-function nndoc-body-end
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
389 nndoc-prepare-body-function nndoc-article-transform-function
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
390 nndoc-header-transform-function
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
391 nndoc-generate-head-function nndoc-body-begin-function
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
392 nndoc-head-begin-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
393 nndoc-generate-article-function
110108
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
394 nndoc-dissection-function
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
395 nndoc-pre-dissection-function)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
396 (while vars
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
397 (set (pop vars) nil)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
398 (let (defs)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
399 ;; Guess away until we find the real file type.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
400 (while (assq 'guess (setq defs (cdr (assq nndoc-article-type
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
401 nndoc-type-alist))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
402 (setq nndoc-article-type (nndoc-guess-type nndoc-article-type)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
403 ;; Set the nndoc variables.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
404 (while defs
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
405 (set (intern (format "nndoc-%s" (caar defs)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
406 (cdr (pop defs))))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
407
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
408 (defun nndoc-guess-type (subtype)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
409 (let ((alist nndoc-type-alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
410 results result entry)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
411 (while (and (not result)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
412 (setq entry (pop alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
413 (when (memq subtype (or (cdr (assq 'subtype entry)) '(guess)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
414 (goto-char (point-min))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
415 ;; Remove blank lines.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
416 (while (eq (following-char) ?\n)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
417 (delete-char 1))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
418 (when (numberp (setq result (funcall (intern
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
419 (format "nndoc-%s-type-p"
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
420 (car entry))))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
421 (push (cons result entry) results)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
422 (setq result nil))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
423 (unless (or result results)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
424 (error "Document is not of any recognized type"))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
425 (if result
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
426 (car entry)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
427 (cadar (last (sort results 'car-less-than-car))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
428
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
429 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
430 ;;; Built-in type predicates and functions
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
431 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
432
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
433 (defun nndoc-mbox-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
434 (when (looking-at message-unix-mail-delimiter)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
435 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
436
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
437 (defun nndoc-mbox-article-begin ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
438 (when (re-search-forward (concat "^" message-unix-mail-delimiter) nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
439 (goto-char (match-beginning 0))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
440
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
441 (defun nndoc-mbox-body-end ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
442 (let ((beg (point))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
443 len end)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
444 (when
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
445 (save-excursion
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
446 (and (re-search-backward
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
447 (concat "^" message-unix-mail-delimiter) nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
448 (setq end (point))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
449 (search-forward "\n\n" beg t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
450 (re-search-backward
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
451 "^Content-Length:[ \t]*\\([0-9]+\\) *$" end t)
62907
88db2adda4b7 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
452 (setq len (string-to-number (match-string 1)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
453 (search-forward "\n\n" beg t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
454 (unless (= (setq len (+ (point) len)) (point-max))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
455 (and (< len (point-max))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
456 (goto-char len)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
457 (looking-at message-unix-mail-delimiter)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
458 (goto-char len))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
459
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
460 (defun nndoc-mmdf-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
461 (when (looking-at "\^A\^A\^A\^A$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
462 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
463
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
464 (defun nndoc-news-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
465 (when (looking-at "^Path:.*\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
466 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
467
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
468 (defun nndoc-rnews-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
469 (when (looking-at "#! *rnews")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
470 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
471
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
472 (defun nndoc-rnews-body-end ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
473 (and (re-search-backward nndoc-article-begin nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
474 (forward-line 1)
62907
88db2adda4b7 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
475 (goto-char (+ (point) (string-to-number (match-string 1))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
476
110108
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
477 (defun nndoc-google-type-p ()
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
478 (when (re-search-forward "^=3D=3D 1 of [0-9]+ =3D=3D$" nil t)
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
479 t))
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
480
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
481 (defun nndoc-decode-content-transfer-encoding ()
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
482 (let ((encoding
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
483 (save-restriction
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
484 (message-narrow-to-head)
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
485 (message-fetch-field "content-transfer-encoding"))))
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
486 (when (and encoding
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
487 (search-forward "\n\n" nil t))
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
488 (save-restriction
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
489 (narrow-to-region (point) (point-max))
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
490 (mm-decode-content-transfer-encoding
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
491 (intern (downcase (mail-header-strip encoding))))))))
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
492
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
493 (defun nndoc-babyl-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
494 (when (re-search-forward "\^_\^L *\n" nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
495 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
496
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
497 (defun nndoc-babyl-body-begin ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
498 (re-search-forward "^\n" nil t)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
499 (when (looking-at "\\*\\*\\* EOOH \\*\\*\\*")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
500 (let ((next (or (save-excursion
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
501 (re-search-forward nndoc-article-begin nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
502 (point-max))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
503 (unless (re-search-forward "^\n" next t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
504 (goto-char next)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
505 (forward-line -1)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
506 (insert "\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
507 (forward-line -1)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
508
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
509 (defun nndoc-babyl-head-begin ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
510 (when (re-search-forward "^[0-9].*\n" nil t)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
511 (when (looking-at "\\*\\*\\* EOOH \\*\\*\\*")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
512 (forward-line 1))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
513 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
514
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
515 (defun nndoc-forward-type-p ()
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
516 (when (and (re-search-forward "^-+ \\(Start of \\)?forwarded message.*\n+"
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
517 nil t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
518 (looking-at "[\r\n]*[a-zA-Z][a-zA-Z0-9-]*:\\|^>?From "))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
519 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
520
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
521 (defun nndoc-rfc934-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
522 (when (and (re-search-forward "^-+ Start of forwarded.*\n+" nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
523 (not (re-search-forward "^Subject:.*digest" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
524 (not (re-search-backward "^From:" nil t 2))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
525 (not (re-search-forward "^From:" nil t 2)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
526 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
527
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
528 (defun nndoc-mailman-type-p ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
529 (when (re-search-forward "^--__--__--\n+" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
530 t))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
531
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
532 (defun nndoc-rfc822-forward-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
533 (save-restriction
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
534 (message-narrow-to-head)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
535 (when (re-search-forward "^Content-Type: *message/rfc822" nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
536 t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
537
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
538 (defun nndoc-rfc822-forward-body-end-function ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
539 (goto-char (point-max)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
540
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
541 (defun nndoc-rfc822-forward-generate-article (article &optional head)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
542 (let ((entry (cdr (assq article nndoc-dissection-alist)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
543 (begin (point))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
544 encoding)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
545 (with-current-buffer nndoc-current-buffer
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
546 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
547 (message-narrow-to-head)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
548 (setq encoding (message-fetch-field "content-transfer-encoding"))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
549 (insert-buffer-substring nndoc-current-buffer (car entry) (nth 3 entry))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
550 (when encoding
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
551 (save-restriction
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
552 (narrow-to-region begin (point-max))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
553 (mm-decode-content-transfer-encoding
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
554 (intern (downcase (mail-header-strip encoding))))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
555 (when head
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
556 (goto-char begin)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
557 (when (search-forward "\n\n" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
558 (delete-region (1- (point)) (point-max)))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
559 t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
560
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
561 (defun nndoc-rfc822-forward-generate-head (article)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
562 (nndoc-rfc822-forward-generate-article article 'head))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
563
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
564 (defun nndoc-mime-parts-type-p ()
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
565 (let ((case-fold-search t)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
566 (limit (search-forward "\n\n" nil t)))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
567 (goto-char (point-min))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
568 (when (and limit
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
569 (re-search-forward
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
570 (concat "\
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
571 ^Content-Type:[ \t]*multipart/[a-z]+ *; *\\(\\(\n[ \t]\\)?.*;\\)*"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
572 "\\(\n[ \t]\\)?[ \t]*boundary=\"?[^\"\n]*[^\" \t\n]")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
573 limit t))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
574 t)))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
575
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
576 (defun nndoc-transform-mime-parts (article)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
577 (let* ((entry (cdr (assq article nndoc-dissection-alist)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
578 (headers (nth 5 entry)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
579 (when headers
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
580 (goto-char (point-min))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
581 (insert headers))))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
582
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
583 (defun nndoc-generate-mime-parts-head (article)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
584 (let* ((entry (cdr (assq article nndoc-dissection-alist)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
585 (headers (nth 6 entry)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
586 (save-restriction
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
587 (narrow-to-region (point) (point))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
588 (insert-buffer-substring
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
589 nndoc-current-buffer (car entry) (nth 1 entry))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
590 (goto-char (point-max)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
591 (when headers
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
592 (insert headers))))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
593
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
594 (defun nndoc-clari-briefs-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
595 (when (let ((case-fold-search nil))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
596 (re-search-forward "^\t[^a-z]+ ([^a-z]+) --" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
597 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
598
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
599 (defun nndoc-transform-clari-briefs (article)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
600 (goto-char (point-min))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
601 (when (looking-at " *\\*\\(.*\\)\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
602 (replace-match "" t t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
603 (nndoc-generate-clari-briefs-head article))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
604
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
605 (defun nndoc-generate-clari-briefs-head (article)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
606 (let ((entry (cdr (assq article nndoc-dissection-alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
607 subject from)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
608 (with-current-buffer nndoc-current-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
609 (save-restriction
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
610 (narrow-to-region (car entry) (nth 3 entry))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
611 (goto-char (point-min))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
612 (when (looking-at " *\\*\\(.*\\)$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
613 (setq subject (match-string 1))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
614 (when (string-match "[ \t]+$" subject)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
615 (setq subject (substring subject 0 (match-beginning 0)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
616 (when
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
617 (let ((case-fold-search nil))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
618 (re-search-forward
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
619 "^\t\\([^a-z]+\\(,[^(]+\\)? ([^a-z]+)\\) --" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
620 (setq from (match-string 1)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
621 (insert "From: " "clari@clari.net (" (or from "unknown") ")"
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
622 "\nSubject: " (or subject "(no subject)") "\n")))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
623
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
624 (defun nndoc-exim-bounce-type-p ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
625 (and (re-search-forward "^------ This is a copy of the message, including all the headers. ------" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
626 t))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
627
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
628 (defun nndoc-exim-bounce-body-end-function ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
629 (goto-char (point-max)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
630
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
631
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
632 (defun nndoc-mime-digest-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
633 (let ((case-fold-search t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
634 boundary-id b-delimiter entry)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
635 (when (and
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
636 (re-search-forward
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
637 (concat "^Content-Type: *multipart/digest;[ \t\n]*[ \t]"
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
638 "boundary=\"?\\([^\"\n]*[^\" \t\n]\\)")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
639 nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
640 (match-beginning 1))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
641 (setq boundary-id (match-string 1)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
642 b-delimiter (concat "\n--" boundary-id "[ \t]*$"))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
643 (setq entry (assq 'mime-digest nndoc-type-alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
644 (setcdr entry
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
645 (list
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
646 (cons 'head-begin "^ ?\n")
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
647 (cons 'head-end "^ ?$")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
648 (cons 'body-begin "^ ?\n")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
649 (cons 'article-begin b-delimiter)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
650 (cons 'body-end-function 'nndoc-digest-body-end)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
651 (cons 'file-end (concat "^--" boundary-id "--[ \t]*$"))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
652 t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
653
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
654 (defun nndoc-standard-digest-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
655 (when (and (re-search-forward (concat "^" (make-string 70 ?-) "\n\n") nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
656 (re-search-forward
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
657 (concat "\n\n" (make-string 30 ?-) "\n\n") nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
658 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
659
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
660 (defun nndoc-digest-body-end ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
661 (and (re-search-forward nndoc-article-begin nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
662 (goto-char (match-beginning 0))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
663
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
664 (defun nndoc-slack-digest-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
665 0)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
666
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
667 (defun nndoc-git-type-p ()
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
668 (and (search-forward "\n- Log ---" nil t)
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
669 (search-forward "\ncommit " nil t)
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
670 (search-forward "\nAuthor: " nil t)))
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
671
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
672 (defun nndoc-transform-git-article (article)
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
673 (goto-char (point-min))
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
674 (when (re-search-forward "^Author: " nil t)
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
675 (replace-match "From: " t t)))
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
676
111056
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
677 (defun nndoc-transform-git-headers (entry)
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
678 (goto-char (point-min))
111056
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
679 (when (re-search-forward "^Author: " nil t)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
680 (replace-match "From: " t t))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
681 (let (subject)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
682 (with-current-buffer nndoc-current-buffer
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
683 (goto-char (car entry))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
684 (when (search-forward "\n\n" nil t)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
685 (setq subject (buffer-substring (point) (line-end-position)))))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
686 (when subject
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
687 (goto-char (point-min))
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
688 (forward-line 1)
062487f243c2 nndoc.el (nndoc-transform-git-headers): Generate Subject headers.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111054
diff changeset
689 (insert (format "Subject: %s\n" subject)))))
111054
779cd575396a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110859
diff changeset
690
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
691 (defun nndoc-lanl-gov-announce-type-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
692 (when (let ((case-fold-search nil))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
693 (re-search-forward "^\\\\\\\\\n\\(Paper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+\\|arXiv:\\)" nil t))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
694 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
695
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
696 (defun nndoc-transform-lanl-gov-announce (article)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
697 (let ((case-fold-search nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
698 (goto-char (point-max))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
699 (when (re-search-backward "^\\\\\\\\ +( *\\([^ ]*\\) , *\\([^ ]*\\))" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
700 (replace-match "\n\nGet it at \\1 (\\2)" t nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
701 (goto-char (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
702 (while (re-search-forward "^\\\\\\\\$" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
703 (replace-match "" t nil))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
704 (goto-char (point-min))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
705 (when (re-search-forward "^replaced with revised version +\\(.*[^ ]\\) +" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
706 (replace-match "Date: \\1 (revised) " t nil))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
707 (goto-char (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
708 (unless (re-search-forward "^From" nil t)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
709 (goto-char (point-min))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
710 (when (re-search-forward "^Authors?: \\(.*\\)" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
711 (goto-char (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
712 (insert "From: " (match-string 1) "\n")))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
713 (when (re-search-forward "^arXiv:" nil t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
714 (replace-match "Paper: arXiv:" t nil))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
715
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
716 (defun nndoc-generate-lanl-gov-head (article)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
717 (let ((entry (cdr (assq article nndoc-dissection-alist)))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
718 (from "<no address given>")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
719 subject date)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
720 (with-current-buffer nndoc-current-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
721 (save-restriction
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
722 (narrow-to-region (car entry) (nth 1 entry))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
723 (goto-char (point-min))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
724 (when (looking-at "^\\(Paper.*: \\|arXiv:\\)\\([0-9a-zA-Z-\\./]+\\)")
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
725 (setq subject (concat " (" (match-string 2) ")"))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
726 (when (re-search-forward "^From: \\(.*\\)" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
727 (setq from (concat "<"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45957
diff changeset
728 (cadr (funcall gnus-extract-address-components
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
729 (match-string 1))) ">")))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
730 (if (re-search-forward "^Date: +\\([^(]*\\)" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
731 (setq date (match-string 1))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
732 (when (re-search-forward "^replaced with revised version +\\([^(]*\\)" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
733 (setq date (match-string 1))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
734 (when (re-search-forward "^Title: \\([^\f]*\\)\nAuthors?: \\(.*\\)"
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
735 nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
736 (setq subject (concat (match-string 1) subject))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
737 (setq from (concat (match-string 2) " " from))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
738 (while (and from (string-match "(\[^)\]*)" from))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
739 (setq from (replace-match "" t t from)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
740 (insert "From: " (or from "unknown")
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
741 "\nSubject: " (or subject "(no subject)") "\n")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
742 (if date (insert "Date: " date))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
743
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
744 (defun nndoc-nsmail-type-p ()
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
745 (when (looking-at "From - ")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
746 t))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
747
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
748 (defun nndoc-outlook-article-begin ()
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
749 (prog1 (re-search-forward "From:\\|Received:" nil t)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
750 (goto-char (match-beginning 0))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
751
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
752 (defun nndoc-outlook-type-p ()
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
753 ;; FIXME: Is JMF the magic of outlook mailbox? -- ShengHuo.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
754 (looking-at "JMF"))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
755
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
756 (defun nndoc-oe-dbx-type-p ()
92432
4fe0858e4c31 (nndoc-oe-dbx-type-p): Use mm-string-to-multibyte.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
757 (looking-at (mm-string-to-multibyte "\317\255\022\376")))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
758
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
759 (defun nndoc-read-little-endian ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
760 (+ (prog1 (char-after) (forward-char 1))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
761 (lsh (prog1 (char-after) (forward-char 1)) 8)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
762 (lsh (prog1 (char-after) (forward-char 1)) 16)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
763 (lsh (prog1 (char-after) (forward-char 1)) 24)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
764
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
765 (defun nndoc-oe-dbx-decode-block ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
766 (list
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
767 (nndoc-read-little-endian) ;; this address
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
768 (nndoc-read-little-endian) ;; next address offset
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
769 (nndoc-read-little-endian) ;; blocksize
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
770 (nndoc-read-little-endian))) ;; next address
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
771
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
772 (defun nndoc-oe-dbx-dissection ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
773 (let ((i 0) blk p tp)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
774 (goto-char 60117) ;; 0x0000EAD4+1
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
775 (setq p (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
776 (unless (eobp)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
777 (setq blk (nndoc-oe-dbx-decode-block)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
778 (while (and blk (> (car blk) 0) (or (zerop (nth 3 blk))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
779 (> (nth 3 blk) p)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
780 (push (list (incf i) p nil nil nil 0) nndoc-dissection-alist)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
781 (while (and (> (car blk) 0) (> (nth 3 blk) p))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
782 (goto-char (1+ (nth 3 blk)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
783 (setq blk (nndoc-oe-dbx-decode-block)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
784 (if (or (<= (car blk) p)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
785 (<= (nth 1 blk) 0)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
786 (not (zerop (nth 3 blk))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
787 (setq blk nil)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
788 (setq tp (+ (car blk) (nth 1 blk) 17))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
789 (if (or (<= tp p) (>= tp (point-max)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
790 (setq blk nil)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
791 (goto-char tp)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
792 (setq p tp
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
793 blk (nndoc-oe-dbx-decode-block)))))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
794
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
795 (defun nndoc-oe-dbx-generate-article (article &optional head)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
796 (let ((entry (cdr (assq article nndoc-dissection-alist)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
797 (cur (current-buffer))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
798 (begin (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
799 blk p)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
800 (with-current-buffer nndoc-current-buffer
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
801 (setq p (car entry))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
802 (while (> p (point-min))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
803 (goto-char p)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
804 (setq blk (nndoc-oe-dbx-decode-block))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
805 (setq p (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
806 (with-current-buffer cur
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
807 (insert-buffer-substring nndoc-current-buffer p (+ p (nth 2 blk))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
808 (setq p (1+ (nth 3 blk)))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
809 (goto-char begin)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
810 (while (re-search-forward "\r$" nil t)
108765
d835100c3e8b Replace Lisp calls to delete-backward-char by delete-char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106815
diff changeset
811 (delete-char -1))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
812 (when head
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
813 (goto-char begin)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
814 (when (search-forward "\n\n" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
815 (setcar (cddddr entry) (count-lines (point) (point-max)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
816 (delete-region (1- (point)) (point-max))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
817 t))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
818
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
819 (defun nndoc-oe-dbx-generate-head (article)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
820 (nndoc-oe-dbx-generate-article article 'head))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
821
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
822 (defun nndoc-mail-in-mail-type-p ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
823 (let (found)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
824 (save-excursion
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
825 (catch 'done
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
826 (while (re-search-forward "\n\n[-A-Za-z0-9]+:" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
827 (setq found 0)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
828 (forward-line)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
829 (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
830 (if (looking-at "[-A-Za-z0-9]+:")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
831 (setq found (1+ found)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
832 (forward-line))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
833 (if (and (> found 0) (looking-at "\n"))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
834 (throw 'done 9999)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
835 nil))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
836
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
837 (defun nndoc-mail-in-mail-article-begin ()
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
838 (let (point found)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
839 (if (catch 'done
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
840 (while (re-search-forward "\n\n\\([-A-Za-z0-9]+:\\)" nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
841 (setq found 0)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
842 (setq point (match-beginning 1))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
843 (forward-line)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
844 (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
845 (if (looking-at "[-A-Za-z0-9]+:")
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
846 (setq found (1+ found)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
847 (forward-line))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
848 (if (and (> found 0) (looking-at "\n"))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
849 (throw 'done t)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
850 nil)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
851 (goto-char point))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
852
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
853 (deffoo nndoc-request-accept-article (group &optional server last)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
854 nil)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
855
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
856 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
857 ;;; Functions for dissecting the documents
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
858 ;;;
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
859
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
860 (defun nndoc-search (regexp)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
861 (prog1
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
862 (re-search-forward regexp nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
863 (beginning-of-line)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
864
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
865 (defun nndoc-dissect-buffer ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
866 "Go through the document and partition it into heads/bodies/articles."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
867 (let ((i 0)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
868 (first t)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
869 art-begin head-begin head-end body-begin body-end)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
870 (setq nndoc-dissection-alist nil)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
871 (with-current-buffer nndoc-current-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
872 (goto-char (point-min))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
873 ;; Remove blank lines.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
874 (while (eq (following-char) ?\n)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
875 (delete-char 1))
110108
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
876 (when nndoc-pre-dissection-function
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
877 (save-excursion
5412f2e311ef gnus-html.el (gnus-html-rescale-image): The rescaling logic scaled down too much; nndoc.el (nndoc-type-alist): Added a new type for Google digests.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110102
diff changeset
878 (funcall nndoc-pre-dissection-function)))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
879 (if nndoc-dissection-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
880 (funcall nndoc-dissection-function)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
881 ;; Find the beginning of the file.
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
882 (when nndoc-file-begin
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
883 (nndoc-search nndoc-file-begin))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
884 ;; Go through the file.
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
885 (while (if (and first nndoc-first-article)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
886 (nndoc-search nndoc-first-article)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
887 (if art-begin
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
888 (goto-char art-begin)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
889 (nndoc-article-begin)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
890 (setq first nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
891 art-begin nil)
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
892 (cond (nndoc-head-begin-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
893 (funcall nndoc-head-begin-function))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
894 (nndoc-head-begin
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
895 (nndoc-search nndoc-head-begin)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
896 (if (or (eobp)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
897 (and nndoc-file-end
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
898 (looking-at nndoc-file-end)))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
899 (goto-char (point-max))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
900 (setq head-begin (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
901 (nndoc-search (or nndoc-head-end "^$"))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
902 (setq head-end (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
903 (if nndoc-body-begin-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
904 (funcall nndoc-body-begin-function)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
905 (nndoc-search (or nndoc-body-begin "^\n")))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
906 (setq body-begin (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
907 (or (and nndoc-body-end-function
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
908 (funcall nndoc-body-end-function))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
909 (and nndoc-body-end
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
910 (nndoc-search nndoc-body-end))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
911 (and (nndoc-article-begin)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
912 (setq art-begin (point)))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
913 (progn
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
914 (goto-char (point-max))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
915 (when nndoc-file-end
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
916 (and (re-search-backward nndoc-file-end nil t)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
917 (beginning-of-line)))))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
918 (setq body-end (point))
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
919 (push (list (incf i) head-begin head-end body-begin body-end
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
920 (count-lines body-begin body-end))
111269
3d7a1caabf14 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111056
diff changeset
921 nndoc-dissection-alist)))))
3d7a1caabf14 Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 111056
diff changeset
922 (setq nndoc-dissection-alist (nreverse nndoc-dissection-alist))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
923
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
924 (defun nndoc-article-begin ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
925 (if nndoc-article-begin-function
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
926 (funcall nndoc-article-begin-function)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
927 (ignore-errors
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
928 (nndoc-search nndoc-article-begin))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
929
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
930 (defun nndoc-unquote-dashes ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
931 "Unquote quoted non-separators in digests."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
932 (while (re-search-forward "^- -"nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
933 (replace-match "-" t t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
934
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
935 ;; Against compiler warnings.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
936 (defvar nndoc-mime-split-ordinal)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
937
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
938 (defun nndoc-dissect-mime-parts ()
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
939 "Go through a MIME composite article and partition it into sub-articles.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
940 When a MIME entity contains sub-entities, dissection produces one article for
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
941 the header of this entity, and one article per sub-entity."
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
942 (setq nndoc-dissection-alist nil
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
943 nndoc-mime-split-ordinal 0)
110410
f2e111723c3a Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110111
diff changeset
944 (with-current-buffer nndoc-current-buffer
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
945 (nndoc-dissect-mime-parts-sub (point-min) (point-max) nil nil nil)))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
946
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
947 (defun nndoc-dissect-mime-parts-sub (head-begin body-end article-insert
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
948 position parent)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
949 "Dissect an entity, within a composite MIME message.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
950 The complete message or MIME entity extends from HEAD-BEGIN to BODY-END.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
951 ARTICLE-INSERT should be added at beginning for generating a full article.
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
952 The string POSITION holds a dotted decimal representation of the article
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
953 position in the hierarchical structure, it is nil for the outer entity.
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
954 PARENT is the message-ID of the parent summary line, or nil for none."
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
955 (let ((case-fold-search t)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
956 (message-id (nnmail-message-id))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
957 head-end body-begin summary-insert message-rfc822 multipart-any
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
958 subject content-type type subtype boundary-regexp)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
959 ;; Gracefully handle a missing body.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
960 (goto-char head-begin)
33325
0ca2ddcb4da5 2000-09-29 09:56:34 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 31716
diff changeset
961 (if (or (and (eq (char-after) ?\n) (or (forward-char 1) t))
0ca2ddcb4da5 2000-09-29 09:56:34 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 31716
diff changeset
962 (search-forward "\n\n" body-end t))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
963 (setq head-end (1- (point))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
964 body-begin (point))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
965 (setq head-end body-end
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
966 body-begin body-end))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
967 (narrow-to-region head-begin head-end)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
968 ;; Save MIME attributes.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
969 (goto-char head-begin)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
970 (setq content-type (message-fetch-field "Content-Type"))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
971 (when content-type
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
972 (when (string-match
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
973 "^ *\\([^ \t\n/;]+\\)/\\([^ \t\n/;]+\\)" content-type)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
974 (setq type (downcase (match-string 1 content-type))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
975 subtype (downcase (match-string 2 content-type))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
976 message-rfc822 (and (string= type "message")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
977 (string= subtype "rfc822"))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
978 multipart-any (string= type "multipart")))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
979 (when (string-match ";[ \t\n]*name=\\([^ \t\n;]+\\)" content-type)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
980 (setq subject (match-string 1 content-type)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
981 (when (string-match "boundary=\"?\\([^\"\n]*[^\" \t\n]\\)" content-type)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
982 (setq boundary-regexp (concat "^--"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
983 (regexp-quote
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
984 (match-string 1 content-type))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
985 "\\(--\\)?[ \t]*\n"))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
986 (unless subject
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
987 (when (or multipart-any (not article-insert))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
988 (setq subject (message-fetch-field "Subject"))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
989 (unless type
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
990 (setq type "text"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
991 subtype "plain"))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
992 ;; Prepare the article and summary inserts.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
993 (unless article-insert
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
994 (setq article-insert (buffer-string)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
995 head-end head-begin))
45957
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
996 ;; Fix MIME-Version
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
997 (unless (string-match "MIME-Version:" article-insert)
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
998 (setq article-insert
4afe5a9ced92 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33325
diff changeset
999 (concat article-insert "MIME-Version: 1.0\n")))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1000 (setq summary-insert article-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1001 ;; - summary Subject.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1002 (setq summary-insert
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1003 (let ((line (concat "Subject: <" position
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1004 (and position multipart-any ".")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1005 (and multipart-any "*")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1006 (and (or position multipart-any) " ")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1007 (cond ((string= subtype "plain") type)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1008 ((string= subtype "basic") type)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1009 (t subtype))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1010 ">"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1011 (and subject " ")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1012 subject
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1013 "\n")))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1014 (if (string-match "Subject:.*\n\\([ \t].*\n\\)*" summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1015 (replace-match line t t summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1016 (concat summary-insert line))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1017 ;; - summary Message-ID.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1018 (setq summary-insert
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1019 (let ((line (concat "Message-ID: " message-id "\n")))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1020 (if (string-match "Message-ID:.*\n\\([ \t].*\n\\)*" summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1021 (replace-match line t t summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1022 (concat summary-insert line))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1023 ;; - summary References.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1024 (when parent
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1025 (setq summary-insert
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1026 (let ((line (concat "References: " parent "\n")))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1027 (if (string-match "References:.*\n\\([ \t].*\n\\)*"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1028 summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1029 (replace-match line t t summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1030 (concat summary-insert line)))))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1031 ;; Generate dissection information for this entity.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1032 (push (list (incf nndoc-mime-split-ordinal)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1033 head-begin head-end body-begin body-end
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1034 (count-lines body-begin body-end)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1035 article-insert summary-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1036 nndoc-dissection-alist)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1037 ;; Recurse for all sub-entities, if any.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1038 (widen)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1039 (cond
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1040 (message-rfc822
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1041 (save-excursion
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1042 (nndoc-dissect-mime-parts-sub body-begin body-end nil
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1043 position message-id)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1044 ((and multipart-any boundary-regexp)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1045 (let ((part-counter 0)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1046 part-begin part-end eof-flag)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1047 (while (string-match "\
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1048 ^\\(Lines\\|Content-\\(Type\\|Transfer-Encoding\\|Disposition\\)\\):.*\n\\([ \t].*\n\\)*"
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1049 article-insert)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1050 (setq article-insert (replace-match "" t t article-insert)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1051 (let ((case-fold-search nil))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1052 (goto-char body-begin)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1053 (setq eof-flag (not (re-search-forward boundary-regexp body-end t)))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1054 (while (not eof-flag)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1055 (setq part-begin (point))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1056 (cond ((re-search-forward boundary-regexp body-end t)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1057 (or (not (match-string 1))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1058 (string= (match-string 1) "")
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1059 (setq eof-flag t))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1060 (forward-line -1)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1061 (setq part-end (point))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1062 (forward-line 1))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1063 (t (setq part-end body-end
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1064 eof-flag t)))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1065 (save-excursion
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1066 (nndoc-dissect-mime-parts-sub
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1067 part-begin part-end article-insert
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1068 (concat position
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1069 (and position ".")
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1070 (format "%d" (incf part-counter)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
1071 message-id)))))))))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
1072
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1073 ;;;###autoload
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1074 (defun nndoc-add-type (definition &optional position)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1075 "Add document DEFINITION to the list of nndoc document definitions.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1076 If POSITION is nil or `last', the definition will be added
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1077 as the last checked definition, if t or `first', add as the
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1078 first definition, and if any other symbol, add after that
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1079 symbol in the alist."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1080 ;; First remove any old instances.
110859
7aa4fdb60d57 shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 110689
diff changeset
1081 (gnus-alist-pull (car definition) nndoc-type-alist)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1082 ;; Then enter the new definition in the proper place.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1083 (cond
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1084 ((or (null position) (eq position 'last))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1085 (setq nndoc-type-alist (nconc nndoc-type-alist (list definition))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1086 ((or (eq position t) (eq position 'first))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1087 (push definition nndoc-type-alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1088 (t
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1089 (let ((list (memq (assq position nndoc-type-alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1090 nndoc-type-alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1091 (unless list
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1092 (error "No such position: %s" position))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1093 (setcdr list (cons definition (cdr list)))))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1094
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1095 (provide 'nndoc)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1096
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1097 ;;; nndoc.el ends here