annotate lisp/nndoc.el @ 15974:61249a8fe735

(Vring_bell_function): New variable. (syms_of_term): Set up Lisp variable. (ring_bell): Use Vring_bell_function.
author Richard M. Stallman <rms@gnu.org>
date Thu, 29 Aug 1996 20:50:15 +0000
parents 530d0d516a42
children b131fbcf8530
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 ;;; nndoc.el --- single file access for Gnus
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
3
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
6 ;; Keywords: news
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
7
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
13 ;; any later version.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
14
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13401
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13401
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13401
diff changeset
23 ;; Boston, MA 02111-1307, USA.
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
24
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25 ;;; Commentary:
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
27 ;;; Code:
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
28
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
29 (require 'nnheader)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
30 (require 'message)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
31 (require 'nnmail)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
32 (require 'nnoo)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
33 (eval-when-compile (require 'cl))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
34
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
35 (nnoo-declare nndoc)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
36
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
37 (defvoo nndoc-article-type 'guess
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
38 "*Type of the file.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
39 One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
40 `mime-digest', `standard-digest', `slack-digest', `clari-briefs' or
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
41 `guess'.")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
42
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
43 (defvoo nndoc-post-type 'mail
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
44 "*Whether the nndoc group is `mail' or `post'.")
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
45
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
46 (defvar nndoc-type-alist
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
47 `((mmdf
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
48 (article-begin . "^\^A\^A\^A\^A\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
49 (body-end . "^\^A\^A\^A\^A\n"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
50 (news
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
51 (article-begin . "^Path:"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
52 (rnews
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
53 (article-begin . "^#! *rnews +\\([0-9]+\\) *\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
54 (body-end-function . nndoc-rnews-body-end))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
55 (mbox
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
56 (article-begin .
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
57 ,(let ((delim (concat "^" message-unix-mail-delimiter)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
58 (if (string-match "\n\\'" delim)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
59 (substring delim 0 (match-beginning 0))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
60 delim)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
61 (body-end-function . nndoc-mbox-body-end))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
62 (babyl
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
63 (article-begin . "\^_\^L *\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
64 (body-end . "\^_")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
65 (body-begin-function . nndoc-babyl-body-begin)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
66 (head-begin-function . nndoc-babyl-head-begin))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
67 (forward
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
68 (article-begin . "^-+ Start of forwarded message -+\n+")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
69 (body-end . "^-+ End of forwarded message -+$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
70 (prepare-body . nndoc-unquote-dashes))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
71 (clari-briefs
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
72 (article-begin . "^ \\*")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
73 (body-end . "^\t------*[ \t]^*\n^ \\*")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
74 (body-begin . "^\t")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
75 (head-end . "^\t")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
76 (generate-head . nndoc-generate-clari-briefs-head)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
77 (article-transform . nndoc-transform-clari-briefs))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
78 (slack-digest
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
79 (article-begin . "^------------------------------*[\n \t]+")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
80 (head-end . "^ ?$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
81 (body-end-function . nndoc-digest-body-end)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
82 (body-begin . "^ ?$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
83 (file-end . "^End of")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
84 (prepare-body . nndoc-unquote-dashes))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
85 (mime-digest
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
86 (article-begin . "")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
87 (head-end . "^ ?$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
88 (body-end . "")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
89 (file-end . ""))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
90 (standard-digest
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
91 (first-article . ,(concat "^" (make-string 70 ?-) "\n\n+"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
92 (article-begin . ,(concat "\n\n" (make-string 30 ?-) "\n\n+"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
93 (prepare-body . nndoc-unquote-dashes)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
94 (body-end-function . nndoc-digest-body-end)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
95 (head-end . "^ ?$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
96 (body-begin . "^ ?\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
97 (file-end . "^End of .*digest.*[0-9].*\n\\*\\*\\|^End of.*Digest *$"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
98 (guess
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
99 (guess . nndoc-guess-type))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
100 (digest
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
101 (guess . nndoc-guess-digest-type))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
102 ))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
103
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
104
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
105
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
106 (defvoo nndoc-file-begin nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
107 (defvoo nndoc-first-article nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
108 (defvoo nndoc-article-end nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
109 (defvoo nndoc-article-begin nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
110 (defvoo nndoc-head-begin nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
111 (defvoo nndoc-head-end nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
112 (defvoo nndoc-file-end nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
113 (defvoo nndoc-body-begin nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
114 (defvoo nndoc-body-end-function nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
115 (defvoo nndoc-body-begin-function nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
116 (defvoo nndoc-head-begin-function nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
117 (defvoo nndoc-body-end nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
118 (defvoo nndoc-dissection-alist nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
119 (defvoo nndoc-prepare-body nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
120 (defvoo nndoc-generate-head nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
121 (defvoo nndoc-article-transform nil)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
122
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
123 (defvoo nndoc-status-string "")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
124 (defvoo nndoc-group-alist nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
125 (defvoo nndoc-current-buffer nil
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
126 "Current nndoc news buffer.")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
127 (defvoo nndoc-address nil)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
128
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
129 (defconst nndoc-version "nndoc 1.0"
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
130 "nndoc version.")
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
131
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
132
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
133
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
134 ;;; Interface functions
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
135
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
136 (nnoo-define-basics nndoc)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
137
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
138 (deffoo nndoc-retrieve-headers (articles &optional newsgroup server fetch-old)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
139 (when (nndoc-possibly-change-buffer newsgroup server)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
140 (save-excursion
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
141 (set-buffer nntp-server-buffer)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
142 (erase-buffer)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
143 (let (article entry)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
144 (if (stringp (car articles))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
145 'headers
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
146 (while articles
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
147 (when (setq entry (cdr (assq (setq article (pop articles))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
148 nndoc-dissection-alist)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
149 (insert (format "221 %d Article retrieved.\n" article))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
150 (if nndoc-generate-head
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
151 (funcall nndoc-generate-head article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
152 (insert-buffer-substring
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
153 nndoc-current-buffer (car entry) (nth 1 entry)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
154 (goto-char (point-max))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
155 (or (= (char-after (1- (point))) ?\n) (insert "\n"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
156 (insert (format "Lines: %d\n" (nth 4 entry)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
157 (insert ".\n")))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
158
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
159 (nnheader-fold-continuation-lines)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
160 'headers)))))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
161
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
162 (deffoo nndoc-request-article (article &optional newsgroup server buffer)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
163 (nndoc-possibly-change-buffer newsgroup server)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
164 (save-excursion
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
165 (let ((buffer (or buffer nntp-server-buffer))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
166 (entry (cdr (assq article nndoc-dissection-alist)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
167 beg)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
168 (set-buffer buffer)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
169 (erase-buffer)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
170 (if (stringp article)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
171 nil
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
172 (insert-buffer-substring
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
173 nndoc-current-buffer (car entry) (nth 1 entry))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
174 (insert "\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
175 (setq beg (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
176 (insert-buffer-substring
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
177 nndoc-current-buffer (nth 2 entry) (nth 3 entry))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
178 (goto-char beg)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
179 (when nndoc-prepare-body
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
180 (funcall nndoc-prepare-body))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
181 (when nndoc-article-transform
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
182 (funcall nndoc-article-transform article))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
183 t))))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
184
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
185 (deffoo nndoc-request-group (group &optional server dont-check)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
186 "Select news GROUP."
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
187 (let (number)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
188 (cond
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
189 ((not (nndoc-possibly-change-buffer group server))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
190 (nnheader-report 'nndoc "No such file or buffer: %s"
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
191 nndoc-address))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
192 (dont-check
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
193 (nnheader-report 'nndoc "Selected group %s" group)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
194 t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
195 ((zerop (setq number (length nndoc-dissection-alist)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
196 (nndoc-close-group group)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
197 (nnheader-report 'nndoc "No articles in group %s" group))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
198 (t
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
199 (nnheader-insert "211 %d %d %d %s\n" number 1 number group)))))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
200
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
201 (deffoo nndoc-request-type (group &optional article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
202 (cond ((not article) 'unknown)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
203 (nndoc-post-type nndoc-post-type)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
204 (t 'unknown)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
205
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
206 (deffoo nndoc-close-group (group &optional server)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
207 (nndoc-possibly-change-buffer group server)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
208 (and nndoc-current-buffer
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
209 (buffer-name nndoc-current-buffer)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
210 (kill-buffer nndoc-current-buffer))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
211 (setq nndoc-group-alist (delq (assoc group nndoc-group-alist)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
212 nndoc-group-alist))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
213 (setq nndoc-current-buffer nil)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
214 (nnoo-close-server 'nndoc server)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
215 (setq nndoc-dissection-alist nil)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
216 t)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
217
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
218 (deffoo nndoc-request-list (&optional server)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
219 nil)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
220
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
221 (deffoo nndoc-request-newgroups (date &optional server)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
222 nil)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
223
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
224 (deffoo nndoc-request-list-newsgroups (&optional server)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
225 nil)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
226
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
227
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
228 ;;; Internal functions.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
229
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
230 (defun nndoc-possibly-change-buffer (group source)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
231 (let (buf)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
232 (cond
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
233 ;; The current buffer is this group's buffer.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
234 ((and nndoc-current-buffer
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
235 (buffer-name nndoc-current-buffer)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
236 (eq nndoc-current-buffer
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
237 (setq buf (cdr (assoc group nndoc-group-alist))))))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
238 ;; We change buffers by taking an old from the group alist.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
239 ;; `source' is either a string (a file name) or a buffer object.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
240 (buf
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
241 (setq nndoc-current-buffer buf))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
242 ;; It's a totally new group.
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
243 ((or (and (bufferp nndoc-address)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
244 (buffer-name nndoc-address))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
245 (and (stringp nndoc-address)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
246 (file-exists-p nndoc-address)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
247 (not (file-directory-p nndoc-address))))
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
248 (push (cons group (setq nndoc-current-buffer
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
249 (get-buffer-create
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
250 (concat " *nndoc " group "*"))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
251 nndoc-group-alist)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
252 (setq nndoc-dissection-alist nil)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
253 (save-excursion
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
254 (set-buffer nndoc-current-buffer)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
255 (buffer-disable-undo (current-buffer))
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
256 (erase-buffer)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
257 (if (stringp nndoc-address)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
258 (insert-file-contents nndoc-address)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
259 (insert-buffer-substring nndoc-address)))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
260 ;; Initialize the nndoc structures according to this new document.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
261 (when (and nndoc-current-buffer
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
262 (not nndoc-dissection-alist))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
263 (save-excursion
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
264 (set-buffer nndoc-current-buffer)
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
265 (nndoc-set-delims)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
266 (nndoc-dissect-buffer)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
267 (unless nndoc-current-buffer
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
268 (nndoc-close-server))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
269 ;; Return whether we managed to select a file.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
270 nndoc-current-buffer))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
271
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
272 ;; MIME (RFC 1341) digest hack by Ulrik Dickow <dickow@nbi.dk>.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
273 (defun nndoc-guess-digest-type ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
274 "Guess what digest type the current document is."
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
275 (let ((case-fold-search t) ; We match a bit too much, keep it simple.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
276 boundary-id b-delimiter entry)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
277 (goto-char (point-min))
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
278 (cond
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
279 ;; MIME digest.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
280 ((and
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
281 (re-search-forward
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
282 (concat "^Content-Type: *multipart/digest;[ \t\n]*[ \t]"
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
283 "boundary=\"\\([^\"\n]*[^\" \t\n]\\)\"")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
284 nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
285 (match-beginning 1))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
286 (setq boundary-id (match-string 1)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
287 b-delimiter (concat "\n--" boundary-id "[\n \t]+"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
288 (setq entry (assq 'mime-digest nndoc-type-alist))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
289 (setcdr entry
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
290 (list
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
291 (cons 'head-end "^ ?$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
292 (cons 'body-begin "^ ?\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
293 (cons 'article-begin b-delimiter)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
294 (cons 'body-end-function 'nndoc-digest-body-end)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
295 ; (cons 'body-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
296 ; (concat "\n--" boundary-id "\\(--\\)?[\n \t]+"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
297 (cons 'file-end (concat "\n--" boundary-id "--[ \t]*$"))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
298 'mime-digest)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
299 ;; Standard digest.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
300 ((and (re-search-forward (concat "^" (make-string 70 ?-) "\n\n") nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
301 (re-search-forward
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
302 (concat "\n\n" (make-string 30 ?-) "\n\n") nil t))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
303 'standard-digest)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
304 ;; Stupid digest.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
305 (t
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
306 'slack-digest))))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
307
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
308 (defun nndoc-guess-type ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
309 "Guess what document type is in the current buffer."
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
310 (goto-char (point-min))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
311 (cond
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
312 ((looking-at message-unix-mail-delimiter)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
313 'mbox)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
314 ((looking-at "\^A\^A\^A\^A$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
315 'mmdf)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
316 ((looking-at "^Path:.*\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
317 'news)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
318 ((looking-at "#! *rnews")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
319 'rnews)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
320 ((re-search-forward "\^_\^L *\n" nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
321 'babyl)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
322 ((save-excursion
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
323 (and (re-search-forward "^-+ Start of forwarded message -+\n+" nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
324 (not (re-search-forward "^Subject:.*digest" nil t))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
325 'forward)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
326 ((let ((case-fold-search nil))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
327 (re-search-forward "^\t[^a-z]+ ([^a-z]+) --" nil t))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
328 'clari-briefs)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
329 (t
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
330 'digest)))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
331
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
332 (defun nndoc-set-delims ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
333 "Set the nndoc delimiter variables according to the type of the document."
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
334 (let ((vars '(nndoc-file-begin
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
335 nndoc-first-article
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
336 nndoc-article-end nndoc-head-begin nndoc-head-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
337 nndoc-file-end nndoc-article-begin
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
338 nndoc-body-begin nndoc-body-end-function nndoc-body-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
339 nndoc-prepare-body nndoc-article-transform
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
340 nndoc-generate-head nndoc-body-begin-function
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
341 nndoc-head-begin-function)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
342 (while vars
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
343 (set (pop vars) nil)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
344 (let* (defs guess)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
345 ;; Guess away until we find the real file type.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
346 (while (setq defs (cdr (assq nndoc-article-type nndoc-type-alist))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
347 guess (assq 'guess defs))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
348 (setq nndoc-article-type (funcall (cdr guess))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
349 ;; Set the nndoc variables.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
350 (while defs
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
351 (set (intern (format "nndoc-%s" (caar defs)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
352 (cdr (pop defs))))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
353
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
354 (defun nndoc-search (regexp)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
355 (prog1
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
356 (re-search-forward regexp nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
357 (beginning-of-line)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
358
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
359 (defun nndoc-dissect-buffer ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
360 "Go through the document and partition it into heads/bodies/articles."
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
361 (let ((i 0)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
362 (first t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
363 head-begin head-end body-begin body-end)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
364 (setq nndoc-dissection-alist nil)
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
365 (save-excursion
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
366 (set-buffer nndoc-current-buffer)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
367 (goto-char (point-min))
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
368 ;; Find the beginning of the file.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
369 (when nndoc-file-begin
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
370 (nndoc-search nndoc-file-begin))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
371 ;; Go through the file.
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
372 (while (if (and first nndoc-first-article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
373 (nndoc-search nndoc-first-article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
374 (nndoc-search nndoc-article-begin))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
375 (setq first nil)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
376 (cond (nndoc-head-begin-function
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
377 (funcall nndoc-head-begin-function))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
378 (nndoc-head-begin
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
379 (nndoc-search nndoc-head-begin)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
380 (if (and nndoc-file-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
381 (looking-at nndoc-file-end))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
382 (goto-char (point-max))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
383 (setq head-begin (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
384 (nndoc-search (or nndoc-head-end "^$"))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
385 (setq head-end (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
386 (if nndoc-body-begin-function
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
387 (funcall nndoc-body-begin-function)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
388 (nndoc-search (or nndoc-body-begin "^\n")))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
389 (setq body-begin (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
390 (or (and nndoc-body-end-function
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
391 (funcall nndoc-body-end-function))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
392 (and nndoc-body-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
393 (nndoc-search nndoc-body-end))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
394 (nndoc-search nndoc-article-begin)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
395 (progn
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
396 (goto-char (point-max))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
397 (when nndoc-file-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
398 (and (re-search-backward nndoc-file-end nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
399 (beginning-of-line)))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
400 (setq body-end (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
401 (push (list (incf i) head-begin head-end body-begin body-end
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
402 (count-lines body-begin body-end))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
403 nndoc-dissection-alist))))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
404
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
405 (defun nndoc-unquote-dashes ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
406 "Unquote quoted non-separators in digests."
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
407 (while (re-search-forward "^- -"nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
408 (replace-match "-" t t)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
409
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
410 (defun nndoc-digest-body-end ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
411 (and (re-search-forward nndoc-article-begin nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
412 (goto-char (match-beginning 0))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
413
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
414 (defun nndoc-mbox-body-end ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
415 (let ((beg (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
416 len end)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
417 (when
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
418 (save-excursion
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
419 (and (re-search-backward nndoc-article-begin nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
420 (setq end (point))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
421 (search-forward "\n\n" beg t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
422 (re-search-backward
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
423 "^Content-Length:[ \t]*\\([0-9]+\\) *$" end t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
424 (setq len (string-to-int (match-string 1)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
425 (search-forward "\n\n" beg t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
426 (or (= (setq len (+ (point) len)) (point-max))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
427 (and (< len (point-max))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
428 (goto-char len)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
429 (looking-at nndoc-article-begin)))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
430 (goto-char len))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
431
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
432 (defun nndoc-rnews-body-end ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
433 (and (re-search-backward nndoc-article-begin nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
434 (forward-line 1)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
435 (goto-char (+ (point) (string-to-int (match-string 1))))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
436
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
437 (defun nndoc-transform-clari-briefs (article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
438 (goto-char (point-min))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
439 (when (looking-at " *\\*\\(.*\\)\n")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
440 (replace-match "" t t))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
441 (nndoc-generate-clari-briefs-head article))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
442
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
443 (defun nndoc-generate-clari-briefs-head (article)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
444 (let ((entry (cdr (assq article nndoc-dissection-alist)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
445 subject from)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
446 (save-excursion
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
447 (set-buffer nndoc-current-buffer)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
448 (save-restriction
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
449 (narrow-to-region (car entry) (nth 3 entry))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
450 (goto-char (point-min))
15511
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
451 (when (looking-at " *\\*\\(.*\\)$")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
452 (setq subject (match-string 1))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
453 (when (string-match "[ \t]+$" subject)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
454 (setq subject (substring subject 0 (match-beginning 0)))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
455 (when
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
456 (let ((case-fold-search nil))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
457 (re-search-forward
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
458 "^\t\\([^a-z]+\\(,[^(]+\\)? ([^a-z]+)\\) --" nil t))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
459 (setq from (match-string 1)))))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
460 (insert "From: " "clari@clari.net (" (or from "unknown") ")"
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
461 "\nSubject: " (or subject "(no subject)") "\n")))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
462
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
463 (defun nndoc-babyl-body-begin ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
464 (re-search-forward "^\n" nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
465 (when (looking-at "\*\*\* EOOH \*\*\*")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
466 (re-search-forward "^\n" nil t)))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
467
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
468 (defun nndoc-babyl-head-begin ()
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
469 (when (re-search-forward "^[0-9].*\n" nil t)
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
470 (when (looking-at "\*\*\* EOOH \*\*\*")
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
471 (forward-line 1))
530d0d516a42 New version.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 14169
diff changeset
472 t))
13401
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
473
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
474 (provide 'nndoc)
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
475
178d730efae2 entered into RCS
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
476 ;;; nndoc.el ends here