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