Mercurial > emacs
annotate lisp/gnus/nndoc.el @ 90884:64638607bdf3
*** empty log message ***
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Thu, 31 May 2007 14:58:17 +0000 |
parents | 95d0cdf160ea |
children | f55f9811f5d7 |
rev | line source |
---|---|
17493 | 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, |
75347 | 4 ;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
17493 | 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 | 8 ;; Keywords: news |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
17493 | 26 |
27 ;;; Commentary: | |
28 | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
29 ;; 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
|
30 |
17493 | 31 ;;; Code: |
32 | |
33 (require 'nnheader) | |
34 (require 'message) | |
35 (require 'nnmail) | |
36 (require 'nnoo) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
37 (require 'gnus-util) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
38 (require 'mm-util) |
17493 | 39 (eval-when-compile (require 'cl)) |
40 | |
41 (nnoo-declare nndoc) | |
42 | |
43 (defvoo nndoc-article-type 'guess | |
44 "*Type of the file. | |
45 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
|
46 `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
|
47 `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
|
48 `mailman', `exim-bounce', or `guess'.") |
17493 | 49 |
50 (defvoo nndoc-post-type 'mail | |
51 "*Whether the nndoc group is `mail' or `post'.") | |
52 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
53 (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
|
54 "Hook run after opening a document. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
55 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
|
56 from the document.") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
57 |
17493 | 58 (defvar nndoc-type-alist |
59 `((mmdf | |
60 (article-begin . "^\^A\^A\^A\^A\n") | |
61 (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
|
62 (mime-digest |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
63 (article-begin . "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
64 (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
|
65 (head-end . "^ ?$") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
66 (body-end . "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
67 (file-end . "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
68 (subtype digest guess)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
69 (mime-parts |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
70 (generate-head-function . nndoc-generate-mime-parts-head) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
71 (article-transform-function . nndoc-transform-mime-parts)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
72 (nsmail |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
73 (article-begin . "^From - ")) |
17493 | 74 (news |
75 (article-begin . "^Path:")) | |
76 (rnews | |
77 (article-begin . "^#! *rnews +\\([0-9]+\\) *\n") | |
78 (body-end-function . nndoc-rnews-body-end)) | |
79 (mbox | |
80 (article-begin-function . nndoc-mbox-article-begin) | |
81 (body-end-function . nndoc-mbox-body-end)) | |
82 (babyl | |
83 (article-begin . "\^_\^L *\n") | |
84 (body-end . "\^_") | |
85 (body-begin-function . nndoc-babyl-body-begin) | |
86 (head-begin-function . nndoc-babyl-head-begin)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
87 (exim-bounce |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
88 (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
|
89 (body-end-function . nndoc-exim-bounce-body-end-function)) |
17493 | 90 (rfc934 |
91 (article-begin . "^--.*\n+") | |
92 (body-end . "^--.*$") | |
93 (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
|
94 (mailman |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
95 (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
|
96 (body-end . "^--__--__--$") |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
97 (prepare-body-function . nndoc-unquote-dashes)) |
17493 | 98 (clari-briefs |
99 (article-begin . "^ \\*") | |
100 (body-end . "^\t------*[ \t]^*\n^ \\*") | |
101 (body-begin . "^\t") | |
102 (head-end . "^\t") | |
103 (generate-head-function . nndoc-generate-clari-briefs-head) | |
104 (article-transform-function . nndoc-transform-clari-briefs)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
105 |
17493 | 106 (standard-digest |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
107 (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
|
108 (article-begin . ,(concat "^\n" (make-string 30 ?-) "\n *\n+")) |
17493 | 109 (prepare-body-function . nndoc-unquote-dashes) |
110 (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
|
111 (head-end . "^ *$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
112 (body-begin . "^ *\n") |
17493 | 113 (file-end . "^End of .*digest.*[0-9].*\n\\*\\*\\|^End of.*Digest *$") |
114 (subtype digest guess)) | |
115 (slack-digest | |
116 (article-begin . "^------------------------------*[\n \t]+") | |
117 (head-end . "^ ?$") | |
118 (body-end-function . nndoc-digest-body-end) | |
119 (body-begin . "^ ?$") | |
120 (file-end . "^End of") | |
121 (prepare-body-function . nndoc-unquote-dashes) | |
122 (subtype digest guess)) | |
123 (lanl-gov-announce | |
124 (article-begin . "^\\\\\\\\\n") | |
125 (head-begin . "^Paper.*:") | |
126 (head-end . "\\(^\\\\\\\\.*\n\\|-----------------\\)") | |
127 (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
|
128 (body-end . "\\(-------------------------------------------------\\|%-%-%-%-%-%-%-%-%-%-%-%-%-%-\\|%%--%%--%%--%%--%%--%%--%%--%%--\\|%%%---%%%---%%%---%%%---\\)") |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
129 (file-end . "\\(^Title: Recent Seminal\\|%%%---%%%---%%%---%%%---\\)") |
17493 | 130 (generate-head-function . nndoc-generate-lanl-gov-head) |
131 (article-transform-function . nndoc-transform-lanl-gov-announce) | |
132 (subtype preprints guess)) | |
133 (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
|
134 (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
|
135 (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
|
136 (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
|
137 (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
|
138 (outlook |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
139 (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
|
140 (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
|
141 (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
|
142 (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
|
143 (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
|
144 (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
|
145 (forward |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
146 (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
|
147 (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
|
148 (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
|
149 (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
|
150 (article-begin-function . nndoc-mail-in-mail-article-begin)) |
17493 | 151 (guess |
152 (guess . t) | |
153 (subtype nil)) | |
154 (digest | |
155 (guess . t) | |
156 (subtype nil)) | |
157 (preprints | |
158 (guess . t) | |
159 (subtype nil)))) | |
160 | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
161 (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
|
162 "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
|
163 |
17493 | 164 |
165 (defvoo nndoc-file-begin nil) | |
166 (defvoo nndoc-first-article nil) | |
167 (defvoo nndoc-article-begin nil) | |
168 (defvoo nndoc-head-begin nil) | |
169 (defvoo nndoc-head-end nil) | |
170 (defvoo nndoc-file-end nil) | |
171 (defvoo nndoc-body-begin nil) | |
172 (defvoo nndoc-body-end-function nil) | |
173 (defvoo nndoc-body-begin-function nil) | |
174 (defvoo nndoc-head-begin-function nil) | |
175 (defvoo nndoc-body-end nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
176 ;; 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
|
177 ;; 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
|
178 ;; 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
|
179 ;; [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
|
180 ;; 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
|
181 ;; 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
|
182 ;; 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
|
183 ;; buffer. Value `nil' means no insert. |
17493 | 184 (defvoo nndoc-dissection-alist nil) |
185 (defvoo nndoc-prepare-body-function nil) | |
186 (defvoo nndoc-generate-head-function nil) | |
187 (defvoo nndoc-article-transform-function nil) | |
188 (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
|
189 (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
|
190 (defvoo nndoc-dissection-function nil) |
17493 | 191 |
192 (defvoo nndoc-status-string "") | |
193 (defvoo nndoc-group-alist nil) | |
194 (defvoo nndoc-current-buffer nil | |
195 "Current nndoc news buffer.") | |
196 (defvoo nndoc-address nil) | |
197 | |
198 (defconst nndoc-version "nndoc 1.0" | |
199 "nndoc version.") | |
200 | |
201 | |
202 | |
203 ;;; Interface functions | |
204 | |
205 (nnoo-define-basics nndoc) | |
206 | |
207 (deffoo nndoc-retrieve-headers (articles &optional newsgroup server fetch-old) | |
208 (when (nndoc-possibly-change-buffer newsgroup server) | |
209 (save-excursion | |
210 (set-buffer nntp-server-buffer) | |
211 (erase-buffer) | |
212 (let (article entry) | |
213 (if (stringp (car articles)) | |
214 'headers | |
215 (while articles | |
216 (when (setq entry (cdr (assq (setq article (pop articles)) | |
217 nndoc-dissection-alist))) | |
218 (insert (format "221 %d Article retrieved.\n" article)) | |
219 (if nndoc-generate-head-function | |
220 (funcall nndoc-generate-head-function article) | |
221 (insert-buffer-substring | |
222 nndoc-current-buffer (car entry) (nth 1 entry))) | |
223 (goto-char (point-max)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
224 (unless (eq (char-after (1- (point))) ?\n) |
17493 | 225 (insert "\n")) |
226 (insert (format "Lines: %d\n" (nth 4 entry))) | |
227 (insert ".\n"))) | |
228 | |
229 (nnheader-fold-continuation-lines) | |
230 'headers))))) | |
231 | |
232 (deffoo nndoc-request-article (article &optional newsgroup server buffer) | |
233 (nndoc-possibly-change-buffer newsgroup server) | |
234 (save-excursion | |
235 (let ((buffer (or buffer nntp-server-buffer)) | |
236 (entry (cdr (assq article nndoc-dissection-alist))) | |
237 beg) | |
238 (set-buffer buffer) | |
239 (erase-buffer) | |
240 (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
|
241 (cond |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
242 ((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
|
243 (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
|
244 (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
|
245 (t |
17493 | 246 (insert-buffer-substring |
247 nndoc-current-buffer (car entry) (nth 1 entry)) | |
248 (insert "\n") | |
249 (setq beg (point)) | |
250 (insert-buffer-substring | |
251 nndoc-current-buffer (nth 2 entry) (nth 3 entry)) | |
252 (goto-char beg) | |
253 (when nndoc-prepare-body-function | |
254 (funcall nndoc-prepare-body-function)) | |
255 (when nndoc-article-transform-function | |
256 (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
|
257 t)))))) |
17493 | 258 |
259 (deffoo nndoc-request-group (group &optional server dont-check) | |
260 "Select news GROUP." | |
261 (let (number) | |
262 (cond | |
263 ((not (nndoc-possibly-change-buffer group server)) | |
264 (nnheader-report 'nndoc "No such file or buffer: %s" | |
265 nndoc-address)) | |
266 (dont-check | |
267 (nnheader-report 'nndoc "Selected group %s" group) | |
268 t) | |
269 ((zerop (setq number (length nndoc-dissection-alist))) | |
270 (nndoc-close-group group) | |
271 (nnheader-report 'nndoc "No articles in group %s" group)) | |
272 (t | |
273 (nnheader-insert "211 %d %d %d %s\n" number 1 number group))))) | |
274 | |
275 (deffoo nndoc-request-type (group &optional article) | |
276 (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
|
277 (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
|
278 (t 'unknown))) |
17493 | 279 |
280 (deffoo nndoc-close-group (group &optional server) | |
281 (nndoc-possibly-change-buffer group server) | |
282 (and nndoc-current-buffer | |
283 (buffer-name nndoc-current-buffer) | |
284 (kill-buffer nndoc-current-buffer)) | |
285 (setq nndoc-group-alist (delq (assoc group nndoc-group-alist) | |
286 nndoc-group-alist)) | |
287 (setq nndoc-current-buffer nil) | |
288 (nnoo-close-server 'nndoc server) | |
289 (setq nndoc-dissection-alist nil) | |
290 t) | |
291 | |
292 (deffoo nndoc-request-list (&optional server) | |
293 nil) | |
294 | |
295 (deffoo nndoc-request-newgroups (date &optional server) | |
296 nil) | |
297 | |
298 (deffoo nndoc-request-list-newsgroups (&optional server) | |
299 nil) | |
300 | |
301 | |
302 ;;; Internal functions. | |
303 | |
304 (defun nndoc-possibly-change-buffer (group source) | |
305 (let (buf) | |
306 (cond | |
307 ;; The current buffer is this group's buffer. | |
308 ((and nndoc-current-buffer | |
309 (buffer-name nndoc-current-buffer) | |
310 (eq nndoc-current-buffer | |
311 (setq buf (cdr (assoc group nndoc-group-alist)))))) | |
312 ;; We change buffers by taking an old from the group alist. | |
313 ;; `source' is either a string (a file name) or a buffer object. | |
314 (buf | |
315 (setq nndoc-current-buffer buf)) | |
316 ;; It's a totally new group. | |
317 ((or (and (bufferp nndoc-address) | |
318 (buffer-name nndoc-address)) | |
319 (and (stringp nndoc-address) | |
320 (file-exists-p nndoc-address) | |
321 (not (file-directory-p nndoc-address)))) | |
322 (push (cons group (setq nndoc-current-buffer | |
323 (get-buffer-create | |
324 (concat " *nndoc " group "*")))) | |
325 nndoc-group-alist) | |
326 (setq nndoc-dissection-alist nil) | |
327 (save-excursion | |
328 (set-buffer nndoc-current-buffer) | |
329 (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
|
330 (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
|
331 (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
|
332 (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
|
333 (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
|
334 (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
|
335 (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
|
336 (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
|
337 (run-hooks 'nndoc-open-document-hook))))) |
17493 | 338 ;; Initialize the nndoc structures according to this new document. |
339 (when (and nndoc-current-buffer | |
340 (not nndoc-dissection-alist)) | |
341 (save-excursion | |
342 (set-buffer nndoc-current-buffer) | |
343 (nndoc-set-delims) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
344 (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
|
345 (nndoc-dissect-mime-parts) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
346 (nndoc-dissect-buffer)))) |
17493 | 347 (unless nndoc-current-buffer |
348 (nndoc-close-server)) | |
349 ;; Return whether we managed to select a file. | |
350 nndoc-current-buffer)) | |
351 | |
352 ;;; | |
353 ;;; Deciding what document type we have | |
354 ;;; | |
355 | |
356 (defun nndoc-set-delims () | |
357 "Set the nndoc delimiter variables according to the type of the document." | |
358 (let ((vars '(nndoc-file-begin | |
359 nndoc-first-article | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
360 nndoc-article-begin-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
361 nndoc-head-begin nndoc-head-end |
17493 | 362 nndoc-file-end nndoc-article-begin |
363 nndoc-body-begin nndoc-body-end-function nndoc-body-end | |
364 nndoc-prepare-body-function nndoc-article-transform-function | |
365 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
|
366 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
|
367 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
|
368 nndoc-dissection-function))) |
17493 | 369 (while vars |
370 (set (pop vars) nil))) | |
371 (let (defs) | |
372 ;; Guess away until we find the real file type. | |
373 (while (assq 'guess (setq defs (cdr (assq nndoc-article-type | |
374 nndoc-type-alist)))) | |
375 (setq nndoc-article-type (nndoc-guess-type nndoc-article-type))) | |
376 ;; Set the nndoc variables. | |
377 (while defs | |
378 (set (intern (format "nndoc-%s" (caar defs))) | |
379 (cdr (pop defs)))))) | |
380 | |
381 (defun nndoc-guess-type (subtype) | |
382 (let ((alist nndoc-type-alist) | |
383 results result entry) | |
384 (while (and (not result) | |
385 (setq entry (pop alist))) | |
386 (when (memq subtype (or (cdr (assq 'subtype entry)) '(guess))) | |
387 (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
|
388 ;; Remove blank lines. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
389 (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
|
390 (delete-char 1)) |
17493 | 391 (when (numberp (setq result (funcall (intern |
392 (format "nndoc-%s-type-p" | |
393 (car entry)))))) | |
394 (push (cons result entry) results) | |
395 (setq result nil)))) | |
396 (unless (or result results) | |
397 (error "Document is not of any recognized type")) | |
398 (if result | |
399 (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
|
400 (cadar (last (sort results 'car-less-than-car)))))) |
17493 | 401 |
402 ;;; | |
403 ;;; Built-in type predicates and functions | |
404 ;;; | |
405 | |
406 (defun nndoc-mbox-type-p () | |
407 (when (looking-at message-unix-mail-delimiter) | |
408 t)) | |
409 | |
410 (defun nndoc-mbox-article-begin () | |
411 (when (re-search-forward (concat "^" message-unix-mail-delimiter) nil t) | |
412 (goto-char (match-beginning 0)))) | |
413 | |
414 (defun nndoc-mbox-body-end () | |
415 (let ((beg (point)) | |
416 len end) | |
417 (when | |
418 (save-excursion | |
419 (and (re-search-backward | |
420 (concat "^" message-unix-mail-delimiter) nil t) | |
421 (setq end (point)) | |
422 (search-forward "\n\n" beg t) | |
423 (re-search-backward | |
424 "^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
|
425 (setq len (string-to-number (match-string 1))) |
17493 | 426 (search-forward "\n\n" beg t) |
427 (unless (= (setq len (+ (point) len)) (point-max)) | |
428 (and (< len (point-max)) | |
429 (goto-char len) | |
430 (looking-at message-unix-mail-delimiter))))) | |
431 (goto-char len)))) | |
432 | |
433 (defun nndoc-mmdf-type-p () | |
434 (when (looking-at "\^A\^A\^A\^A$") | |
435 t)) | |
436 | |
437 (defun nndoc-news-type-p () | |
438 (when (looking-at "^Path:.*\n") | |
439 t)) | |
440 | |
441 (defun nndoc-rnews-type-p () | |
442 (when (looking-at "#! *rnews") | |
443 t)) | |
444 | |
445 (defun nndoc-rnews-body-end () | |
446 (and (re-search-backward nndoc-article-begin nil t) | |
447 (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
|
448 (goto-char (+ (point) (string-to-number (match-string 1)))))) |
17493 | 449 |
450 (defun nndoc-babyl-type-p () | |
451 (when (re-search-forward "\^_\^L *\n" nil t) | |
452 t)) | |
453 | |
454 (defun nndoc-babyl-body-begin () | |
455 (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
|
456 (when (looking-at "\\*\\*\\* EOOH \\*\\*\\*") |
17493 | 457 (let ((next (or (save-excursion |
458 (re-search-forward nndoc-article-begin nil t)) | |
459 (point-max)))) | |
460 (unless (re-search-forward "^\n" next t) | |
461 (goto-char next) | |
462 (forward-line -1) | |
463 (insert "\n") | |
464 (forward-line -1))))) | |
465 | |
466 (defun nndoc-babyl-head-begin () | |
467 (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
|
468 (when (looking-at "\\*\\*\\* EOOH \\*\\*\\*") |
17493 | 469 (forward-line 1)) |
470 t)) | |
471 | |
472 (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
|
473 (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
|
474 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
|
475 (looking-at "[\r\n]*[a-zA-Z][a-zA-Z0-9-]*:\\|^>?From ")) |
17493 | 476 t)) |
477 | |
478 (defun nndoc-rfc934-type-p () | |
479 (when (and (re-search-forward "^-+ Start of forwarded.*\n+" nil t) | |
480 (not (re-search-forward "^Subject:.*digest" nil t)) | |
481 (not (re-search-backward "^From:" nil t 2)) | |
482 (not (re-search-forward "^From:" nil t 2))) | |
483 t)) | |
484 | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
485 (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
|
486 (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
|
487 t)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
488 |
17493 | 489 (defun nndoc-rfc822-forward-type-p () |
490 (save-restriction | |
491 (message-narrow-to-head) | |
492 (when (re-search-forward "^Content-Type: *message/rfc822" nil t) | |
493 t))) | |
494 | |
495 (defun nndoc-rfc822-forward-body-end-function () | |
496 (goto-char (point-max))) | |
497 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
498 (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
|
499 (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
|
500 (begin (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
501 encoding) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
502 (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
|
503 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
504 (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
|
505 (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
|
506 (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
|
507 (when encoding |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
508 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
509 (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
|
510 (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
|
511 (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
|
512 (when head |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
513 (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
|
514 (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
|
515 (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
|
516 t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
517 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
518 (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
|
519 (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
|
520 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
521 (defun nndoc-mime-parts-type-p () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
522 (let ((case-fold-search t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
523 (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
|
524 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
525 (when (and limit |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
526 (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
527 (concat "\ |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
528 ^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
|
529 "\\(\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
|
530 limit t)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
531 t))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
532 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
533 (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
|
534 (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
|
535 (headers (nth 5 entry))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
536 (when headers |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
537 (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
|
538 (insert headers)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
539 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
540 (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
|
541 (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
|
542 (headers (nth 6 entry))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
543 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
544 (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
|
545 (insert-buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
546 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
|
547 (goto-char (point-max))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
548 (when headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
549 (insert headers)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
550 |
17493 | 551 (defun nndoc-clari-briefs-type-p () |
552 (when (let ((case-fold-search nil)) | |
553 (re-search-forward "^\t[^a-z]+ ([^a-z]+) --" nil t)) | |
554 t)) | |
555 | |
556 (defun nndoc-transform-clari-briefs (article) | |
557 (goto-char (point-min)) | |
558 (when (looking-at " *\\*\\(.*\\)\n") | |
559 (replace-match "" t t)) | |
560 (nndoc-generate-clari-briefs-head article)) | |
561 | |
562 (defun nndoc-generate-clari-briefs-head (article) | |
563 (let ((entry (cdr (assq article nndoc-dissection-alist))) | |
564 subject from) | |
565 (save-excursion | |
566 (set-buffer nndoc-current-buffer) | |
567 (save-restriction | |
568 (narrow-to-region (car entry) (nth 3 entry)) | |
569 (goto-char (point-min)) | |
570 (when (looking-at " *\\*\\(.*\\)$") | |
571 (setq subject (match-string 1)) | |
572 (when (string-match "[ \t]+$" subject) | |
573 (setq subject (substring subject 0 (match-beginning 0))))) | |
574 (when | |
575 (let ((case-fold-search nil)) | |
576 (re-search-forward | |
577 "^\t\\([^a-z]+\\(,[^(]+\\)? ([^a-z]+)\\) --" nil t)) | |
578 (setq from (match-string 1))))) | |
579 (insert "From: " "clari@clari.net (" (or from "unknown") ")" | |
580 "\nSubject: " (or subject "(no subject)") "\n"))) | |
581 | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
582 (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
|
583 (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
|
584 t)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
585 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
586 (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
|
587 (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
|
588 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
589 |
17493 | 590 (defun nndoc-mime-digest-type-p () |
591 (let ((case-fold-search t) | |
592 boundary-id b-delimiter entry) | |
593 (when (and | |
594 (re-search-forward | |
595 (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
|
596 "boundary=\"?\\([^\"\n]*[^\" \t\n]\\)") |
17493 | 597 nil t) |
598 (match-beginning 1)) | |
599 (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
|
600 b-delimiter (concat "\n--" boundary-id "[ \t]*$")) |
17493 | 601 (setq entry (assq 'mime-digest nndoc-type-alist)) |
602 (setcdr entry | |
603 (list | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
604 (cons 'head-begin "^ ?\n") |
17493 | 605 (cons 'head-end "^ ?$") |
606 (cons 'body-begin "^ ?\n") | |
607 (cons 'article-begin b-delimiter) | |
608 (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
|
609 (cons 'file-end (concat "^--" boundary-id "--[ \t]*$")))) |
17493 | 610 t))) |
611 | |
612 (defun nndoc-standard-digest-type-p () | |
613 (when (and (re-search-forward (concat "^" (make-string 70 ?-) "\n\n") nil t) | |
614 (re-search-forward | |
615 (concat "\n\n" (make-string 30 ?-) "\n\n") nil t)) | |
616 t)) | |
617 | |
618 (defun nndoc-digest-body-end () | |
619 (and (re-search-forward nndoc-article-begin nil t) | |
620 (goto-char (match-beginning 0)))) | |
621 | |
622 (defun nndoc-slack-digest-type-p () | |
623 0) | |
624 | |
625 (defun nndoc-lanl-gov-announce-type-p () | |
626 (when (let ((case-fold-search nil)) | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
627 (re-search-forward "^\\\\\\\\\nPaper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+" nil t)) |
17493 | 628 t)) |
629 | |
630 (defun nndoc-transform-lanl-gov-announce (article) | |
631 (goto-char (point-max)) | |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
632 (when (re-search-backward "^\\\\\\\\ +( *\\([^ ]*\\) , *\\([^ ]*\\))" nil t) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
633 (replace-match "\n\nGet it at \\1 (\\2)" t nil)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
634 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
635 (while (re-search-forward "^\\\\\\\\$" nil t) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
636 (replace-match "" t nil)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
637 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
638 (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
|
639 (replace-match "Date: \\1 (revised) " t nil)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
640 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
641 (unless (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
|
642 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
643 (when (re-search-forward "^Authors?: \\(.*\\)" nil t) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
644 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
645 (insert "From: " (match-string 1) "\n")))) |
17493 | 646 |
647 (defun nndoc-generate-lanl-gov-head (article) | |
648 (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
|
649 (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
|
650 subject date) |
17493 | 651 (save-excursion |
652 (set-buffer nndoc-current-buffer) | |
653 (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
|
654 (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
|
655 (goto-char (point-min)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
656 (when (looking-at "^Paper.*: \\([a-zA-Z-\\.]+/[0-9]+\\)") |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
657 (setq subject (concat " (" (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
|
658 (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
|
659 (setq from (concat "<" |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
45957
diff
changeset
|
660 (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
|
661 (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
|
662 (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
|
663 (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
|
664 (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
|
665 (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
|
666 (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
|
667 nil t) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
668 (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
|
669 (setq from (concat (match-string 2) " " from)))))) |
17493 | 670 (while (and from (string-match "(\[^)\]*)" from)) |
671 (setq from (replace-match "" t t from))) | |
672 (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
|
673 "\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
|
674 (if date (insert "Date: " date)))) |
17493 | 675 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
676 (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
|
677 (when (looking-at "From - ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
678 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
679 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
680 (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
|
681 (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
|
682 (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
|
683 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
684 (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
|
685 ;; 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
|
686 (looking-at "JMF")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
687 |
45957
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
688 (defun nndoc-oe-dbx-type-p () |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
689 (looking-at (mm-string-as-multibyte "\317\255\022\376"))) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
690 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
691 (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
|
692 (+ (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
|
693 (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
|
694 (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
|
695 (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
|
696 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
697 (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
|
698 (list |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
699 (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
|
700 (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
|
701 (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
|
702 (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
|
703 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
704 (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
|
705 (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
|
706 (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
|
707 (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
|
708 (unless (eobp) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
709 (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
|
710 (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
|
711 (> (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
|
712 (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
|
713 (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
|
714 (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
|
715 (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
|
716 (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
|
717 (<= (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
|
718 (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
|
719 (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
|
720 (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
|
721 (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
|
722 (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
|
723 (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
|
724 (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
|
725 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
|
726 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
727 (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
|
728 (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
|
729 (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
|
730 (begin (point)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
731 blk p) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
732 (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
|
733 (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
|
734 (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
|
735 (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
|
736 (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
|
737 (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
|
738 (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
|
739 (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
|
740 (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
|
741 (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
|
742 (while (re-search-forward "\r$" nil t) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
743 (delete-backward-char 1)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
744 (when head |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
745 (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
|
746 (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
|
747 (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
|
748 (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
|
749 t)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
750 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
751 (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
|
752 (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
|
753 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
754 (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
|
755 (let (found) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
756 (save-excursion |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
757 (catch 'done |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
758 (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
|
759 (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
|
760 (forward-line) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
761 (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
|
762 (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
|
763 (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
|
764 (forward-line)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
765 (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
|
766 (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
|
767 nil)))) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
768 |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
769 (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
|
770 (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
|
771 (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
|
772 (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
|
773 (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
|
774 (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
|
775 (forward-line) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
776 (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
|
777 (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
|
778 (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
|
779 (forward-line)) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
780 (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
|
781 (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
|
782 nil) |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
783 (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
|
784 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
785 (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
|
786 nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
787 |
17493 | 788 ;;; |
789 ;;; Functions for dissecting the documents | |
790 ;;; | |
791 | |
792 (defun nndoc-search (regexp) | |
793 (prog1 | |
794 (re-search-forward regexp nil t) | |
795 (beginning-of-line))) | |
796 | |
797 (defun nndoc-dissect-buffer () | |
798 "Go through the document and partition it into heads/bodies/articles." | |
799 (let ((i 0) | |
800 (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
|
801 art-begin head-begin head-end body-begin body-end) |
17493 | 802 (setq nndoc-dissection-alist nil) |
803 (save-excursion | |
804 (set-buffer nndoc-current-buffer) | |
805 (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
|
806 ;; Remove blank lines. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
807 (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
|
808 (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
|
809 (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
|
810 (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
|
811 ;; 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
|
812 (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
|
813 (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
|
814 ;; 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
|
815 (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
|
816 (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
|
817 (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
|
818 (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
|
819 (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
|
820 (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
|
821 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
|
822 (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
|
823 (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
|
824 (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
|
825 (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
|
826 (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
|
827 (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
|
828 (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
|
829 (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
|
830 (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
|
831 (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
|
832 (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
|
833 (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
|
834 (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
|
835 (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
|
836 (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
|
837 (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
|
838 (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
|
839 (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
|
840 (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
|
841 (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
|
842 (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
|
843 (progn |
4afe5a9ced92
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33325
diff
changeset
|
844 (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
|
845 (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
|
846 (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
|
847 (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
|
848 (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
|
849 (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
|
850 (count-lines 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
|
851 nndoc-dissection-alist))))))) |
17493 | 852 |
853 (defun nndoc-article-begin () | |
854 (if nndoc-article-begin-function | |
855 (funcall nndoc-article-begin-function) | |
856 (ignore-errors | |
857 (nndoc-search nndoc-article-begin)))) | |
858 | |
859 (defun nndoc-unquote-dashes () | |
860 "Unquote quoted non-separators in digests." | |
861 (while (re-search-forward "^- -"nil t) | |
862 (replace-match "-" t t))) | |
863 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
864 ;; Against compiler warnings. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
865 (defvar nndoc-mime-split-ordinal) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
866 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
867 (defun nndoc-dissect-mime-parts () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
868 "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
|
869 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
|
870 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
|
871 (setq nndoc-dissection-alist nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
872 nndoc-mime-split-ordinal 0) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
873 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
874 (set-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
|
875 (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
|
876 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
877 (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
|
878 position parent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
879 "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
|
880 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
|
881 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
|
882 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
|
883 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
|
884 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
|
885 (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
|
886 (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
|
887 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
|
888 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
|
889 ;; 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
|
890 (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
|
891 (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
|
892 (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
|
893 (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
|
894 body-begin (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
895 (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
|
896 body-begin body-end)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
897 (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
|
898 ;; Save MIME attributes. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
899 (goto-char head-begin) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
900 (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
|
901 (when content-type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
902 (when (string-match |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
903 "^ *\\([^ \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
|
904 (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
|
905 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
|
906 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
|
907 (string= subtype "rfc822")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
908 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
|
909 (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
|
910 (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
|
911 (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
|
912 (setq boundary-regexp (concat "^--" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
913 (regexp-quote |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
914 (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
|
915 "\\(--\\)?[ \t]*\n")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
916 (unless subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
917 (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
|
918 (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
|
919 (unless type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
920 (setq type "text" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
921 subtype "plain")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
922 ;; 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
|
923 (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
|
924 (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
|
925 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
|
926 ;; 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
|
927 (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
|
928 (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
|
929 (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
|
930 (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
|
931 ;; - summary Subject. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
932 (setq summary-insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
933 (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
|
934 (and position multipart-any ".") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
935 (and multipart-any "*") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
936 (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
|
937 (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
|
938 ((string= subtype "basic") type) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
939 (t subtype)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
940 ">" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
941 (and subject " ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
942 subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
943 "\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
944 (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
|
945 (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
|
946 (concat summary-insert line)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
947 ;; - summary Message-ID. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
948 (setq summary-insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
949 (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
|
950 (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
|
951 (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
|
952 (concat summary-insert line)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
953 ;; - summary References. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
954 (when parent |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
955 (setq summary-insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
956 (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
|
957 (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
|
958 summary-insert) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
959 (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
|
960 (concat summary-insert line))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
961 ;; 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
|
962 (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
|
963 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
|
964 (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
|
965 article-insert summary-insert) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
966 nndoc-dissection-alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
967 ;; 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
|
968 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
969 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
970 (message-rfc822 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
971 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
972 (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
|
973 position message-id))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
974 ((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
|
975 (let ((part-counter 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
976 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
|
977 (while (string-match "\ |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
978 ^\\(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
|
979 article-insert) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
980 (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
|
981 (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
|
982 (goto-char body-begin) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
983 (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
|
984 (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
|
985 (setq part-begin (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
986 (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
|
987 (or (not (match-string 1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
988 (string= (match-string 1) "") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
989 (setq eof-flag t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
990 (forward-line -1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
991 (setq part-end (point)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
992 (forward-line 1)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
993 (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
|
994 eof-flag t))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
995 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
996 (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
|
997 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
|
998 (concat position |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
999 (and position ".") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1000 (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
|
1001 message-id))))))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
1002 |
17493 | 1003 ;;;###autoload |
1004 (defun nndoc-add-type (definition &optional position) | |
1005 "Add document DEFINITION to the list of nndoc document definitions. | |
1006 If POSITION is nil or `last', the definition will be added | |
1007 as the last checked definition, if t or `first', add as the | |
1008 first definition, and if any other symbol, add after that | |
1009 symbol in the alist." | |
1010 ;; First remove any old instances. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
1011 (gnus-pull (car definition) nndoc-type-alist) |
17493 | 1012 ;; Then enter the new definition in the proper place. |
1013 (cond | |
1014 ((or (null position) (eq position 'last)) | |
1015 (setq nndoc-type-alist (nconc nndoc-type-alist (list definition)))) | |
1016 ((or (eq position t) (eq position 'first)) | |
1017 (push definition nndoc-type-alist)) | |
1018 (t | |
1019 (let ((list (memq (assq position nndoc-type-alist) | |
1020 nndoc-type-alist))) | |
1021 (unless list | |
1022 (error "No such position: %s" position)) | |
1023 (setcdr list (cons definition (cdr list))))))) | |
1024 | |
1025 (provide 'nndoc) | |
1026 | |
52401 | 1027 ;;; arch-tag: f5c2970e-0387-47ac-a0b3-6cc317dffabe |
17493 | 1028 ;;; nndoc.el ends here |