annotate lisp/gnus/nnml.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents cf808b4c4290
children 48d667d6f17f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; nnml.el --- mail spool access for Gnus
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;; Copyright (C) 1995,96,97 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: news, mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; For an overview of what the interface functions do, please see the
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
29 ;; Gnus sources.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (require 'nnheader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (require 'nnmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'nnoo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (nnoo-declare nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvoo nnml-directory message-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 "Mail spool directory.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
43 (defvoo nnml-active-file
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (concat (file-name-as-directory nnml-directory) "active")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "Mail active file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
47 (defvoo nnml-newsgroups-file
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (concat (file-name-as-directory nnml-directory) "newsgroups")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "Mail newsgroups description file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (defvoo nnml-get-new-mail t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 "If non-nil, nnml will check the incoming mail file and split the mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defvoo nnml-nov-is-evil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 "If non-nil, Gnus will never generate and use nov databases for mail groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 Using nov databases will speed up header fetching considerably.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
57 This variable shouldn't be flipped much. If you have, for some reason,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 set this to t, and want to set it to nil again, you should always run
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
59 the `nnml-generate-nov-databases' command. The function will go
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 through all nnml directories and generate nov databases for them
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
61 all. This may very well take some time.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvoo nnml-prepare-save-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Hook run narrowed to an article before saving.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defvoo nnml-inhibit-expiry nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "If non-nil, inhibit expiry.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defconst nnml-version "nnml 1.0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "nnml version.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (defvoo nnml-nov-file-name ".overview")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defvoo nnml-current-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (defvoo nnml-current-group nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (defvoo nnml-status-string "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (defvoo nnml-nov-buffer-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defvoo nnml-group-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (defvoo nnml-active-timestamp nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defvoo nnml-article-file-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defvoo nnml-generate-active-function 'nnml-generate-active-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;;; Interface functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (nnoo-define-basics nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 (deffoo nnml-retrieve-headers (sequence &optional group server fetch-old)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
94 (when (nnml-possibly-change-directory group server)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
96 (set-buffer nntp-server-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
97 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
98 (let ((file nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
99 (number (length sequence))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100 (count 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 beg article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102 (if (stringp (car sequence))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103 'headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
104 (if (nnml-retrieve-headers-with-nov sequence fetch-old)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
105 'nov
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
106 (while sequence
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
107 (setq article (car sequence))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
108 (setq file (nnml-article-to-file article))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
109 (when (and file
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
110 (file-exists-p file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
111 (not (file-directory-p file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
112 (insert (format "221 %d Article retrieved.\n" article))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
113 (setq beg (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
114 (nnheader-insert-head file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
115 (goto-char beg)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
116 (if (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
117 (forward-char -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
118 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
119 (insert "\n\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
120 (insert ".\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
121 (delete-region (point) (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
122 (setq sequence (cdr sequence))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
123 (setq count (1+ count))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
124 (and (numberp nnmail-large-newsgroup)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
125 (> number nnmail-large-newsgroup)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
126 (zerop (% count 20))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
127 (nnheader-message 6 "nnml: Receiving headers... %d%%"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
128 (/ (* count 100) number))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
129
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (and (numberp nnmail-large-newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (> number nnmail-large-newsgroup)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 (nnheader-message 6 "nnml: Receiving headers...done"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
134 (nnheader-fold-continuation-lines)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
135 'headers))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (deffoo nnml-open-server (server &optional defs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (nnoo-change-server 'nnml server defs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (when (not (file-exists-p nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (make-directory nnml-directory t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
142 (error)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
143 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ((not (file-exists-p nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (nnml-close-server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (nnheader-report 'nnml "Couldn't create directory: %s" nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ((not (file-directory-p (file-truename nnml-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (nnml-close-server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (nnheader-report 'nnml "Not a directory: %s" nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (nnheader-report 'nnml "Opened server %s using directory %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 server nnml-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
155 (defun nnml-request-regenerate (server)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
156 (nnml-possibly-change-directory nil server)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
157 (nnml-generate-nov-databases)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
158 t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
159
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
160 (deffoo nnml-request-article (id &optional group server buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
161 (nnml-possibly-change-directory group server)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (let* ((nntp-server-buffer (or buffer nntp-server-buffer))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
163 path gpath group-num)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (if (stringp id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (when (and (setq group-num (nnml-find-group-number id))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
166 (cdr
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
167 (assq (cdr group-num)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
168 (nnheader-article-to-file-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
169 (setq gpath
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
170 (nnmail-group-pathname
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
171 (car group-num)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
172 nnml-directory))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (setq path (concat gpath (int-to-string (cdr group-num)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
174 (setq path (nnml-article-to-file id)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
175 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ((not path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (nnheader-report 'nnml "No such article: %s" id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ((not (file-exists-p path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (nnheader-report 'nnml "No such file: %s" path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ((file-directory-p path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (nnheader-report 'nnml "File is a directory: %s" path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ((not (save-excursion (nnmail-find-file path)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (nnheader-report 'nnml "Couldn't read file: %s" path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (nnheader-report 'nnml "Article %s retrieved" id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; We return the article number.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
187 (cons (if group-num (car group-num) group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
188 (string-to-int (file-name-nondirectory path)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (deffoo nnml-request-group (group &optional server dont-check)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
191 (cond
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ((not (nnml-possibly-change-directory group server))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (nnheader-report 'nnml "Invalid group (no such directory)"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
194 ((not (file-exists-p nnml-current-directory))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
195 (nnheader-report 'nnml "Directory %s does not exist"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
196 nnml-current-directory))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ((not (file-directory-p nnml-current-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
199 (dont-check
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (nnheader-report 'nnml "Group %s selected" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
203 (nnheader-re-read-dir nnml-current-directory)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (nnmail-activate 'nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (let ((active (nth 1 (assoc group nnml-group-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (if (not active)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (nnheader-report 'nnml "No such group: %s" group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (nnheader-report 'nnml "Selected group %s" group)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
209 (nnheader-insert "211 %d %d %d %s\n"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (max (1+ (- (cdr active) (car active))) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (car active) (cdr active) group))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (deffoo nnml-request-scan (&optional group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (setq nnml-article-file-alist nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
215 (nnml-possibly-change-directory group server)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (nnmail-get-new-mail 'nnml 'nnml-save-nov nnml-directory group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (deffoo nnml-close-group (group &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (setq nnml-article-file-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
222 (deffoo nnml-request-create-group (group &optional server args)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (nnmail-activate 'nnml)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
224 (unless (assoc group nnml-group-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
225 (let (active)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
226 (push (list group (setq active (cons 1 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
227 nnml-group-alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
228 (nnml-possibly-create-directory group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
229 (nnml-possibly-change-directory group server)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
230 (let ((articles (nnheader-directory-articles nnml-current-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
231 (when articles
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
232 (setcar active (apply 'min articles))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
233 (setcdr active (apply 'max articles))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
234 (nnmail-save-active nnml-group-alist nnml-active-file)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (deffoo nnml-request-list (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (nnmail-find-file nnml-active-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
240 (setq nnml-group-alist (nnmail-get-active))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
241 t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (deffoo nnml-request-newgroups (date &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (nnml-request-list server))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (deffoo nnml-request-list-newsgroups (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (nnmail-find-file nnml-newsgroups-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
250 (deffoo nnml-request-expire-articles (articles group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
251 &optional server force)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
252 (nnml-possibly-change-directory group server)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
253 (let* ((active-articles
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (nnheader-directory-articles nnml-current-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (is-old t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 article rest mod-time number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (nnmail-activate 'nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (while (and articles is-old)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
260 (when (setq article (nnml-article-to-file (setq number (pop articles))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
261 (when (setq mod-time (nth 5 (file-attributes article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
262 (if (and (nnml-deletable-article-p group number)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
263 (setq is-old
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
264 (nnmail-expired-article-p group mod-time force
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
265 nnml-inhibit-expiry)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
266 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
267 (nnheader-message 5 "Deleting article %s in %s"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
268 article group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
269 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
270 (funcall nnmail-delete-file-function article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
271 (file-error
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
272 (push number rest)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
273 (setq active-articles (delq number active-articles))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
274 (nnml-nov-delete-article group number))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
275 (push number rest)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
276 (let ((active (nth 1 (assoc group nnml-group-alist))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (when active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setcar active (or (and active-articles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (apply 'min active-articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (1+ (cdr active)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (nnmail-save-active nnml-group-alist nnml-active-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (nnml-save-nov)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (nconc rest articles)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
285 (deffoo nnml-request-move-article
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (article group server accept-form &optional last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (let ((buf (get-buffer-create " *nnml move*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (nnml-possibly-change-directory group server)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
290 (nnml-update-file-alist)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
291 (and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (nnml-deletable-article-p group article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (nnml-request-article article group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (insert-buffer-substring nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (setq result (eval accept-form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (nnml-possibly-change-directory group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (funcall nnmail-delete-file-function
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
304 (nnml-article-to-file article))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (file-error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (nnml-nov-delete-article group article)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
307 (when last
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
308 (nnml-save-nov)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
309 (nnmail-save-active nnml-group-alist nnml-active-file))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (deffoo nnml-request-accept-article (group &optional server last)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (nnml-possibly-change-directory group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (nnmail-check-syntax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (let (result)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
316 (nnmail-cache-insert (nnmail-fetch-field "message-id"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (if (stringp group)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
318 (and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (nnmail-activate 'nnml)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
320 (setq result (car (nnml-save-mail
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
321 (list (cons group (nnml-active-number group))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (nnmail-save-active nnml-group-alist nnml-active-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (and last (nnml-save-nov))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (nnmail-activate 'nnml)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
327 (setq result (car (nnml-save-mail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
328 (nnmail-article-group 'nnml-active-number))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
329 (when last
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (nnmail-save-active nnml-group-alist nnml-active-file)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
331 (nnmail-cache-close)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
332 (nnml-save-nov))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (deffoo nnml-request-replace-article (article group buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (nnml-possibly-change-directory group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (nnml-possibly-create-directory group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (let ((chars (nnmail-insert-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (art (concat (int-to-string article) "\t"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (when (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (progn
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
345 (nnmail-write-region
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (point-min) (point-max)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
347 (or (nnml-article-to-file article)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
348 (concat nnml-current-directory
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
349 (int-to-string article)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 nil (if (nnheader-be-verbose 5) nil 'nomesg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (setq headers (nnml-parse-head chars article))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ;; Replace the NOV line in the NOV file.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
355 (save-excursion
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (set-buffer (nnml-open-nov group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (if (or (looking-at art)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (search-forward (concat "\n" art) nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ;; Delete the old NOV line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (delete-region (progn (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (progn (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;; The line isn't here, so we have to find out where
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
364 ;; we should insert it. (This situation should never
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;; occur, but one likes to make sure...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (while (and (looking-at "[0-9]+\t")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
367 (< (string-to-int
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
368 (buffer-substring
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (match-beginning 0) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (zerop (forward-line 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (nnheader-insert-nov headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (nnml-save-nov)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (deffoo nnml-request-delete-group (group &optional force server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (nnml-possibly-change-directory group server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (when force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;; Delete all articles in GROUP.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
381 (let ((articles
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
382 (directory-files
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 nnml-current-directory t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (concat nnheader-numerical-short-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "\\|" (regexp-quote nnml-nov-file-name) "$")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 article)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
387 (while articles
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (setq article (pop articles))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (when (file-writable-p article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (nnheader-message 5 "Deleting article %s in %s..." article group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (funcall nnmail-delete-file-function article))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; Try to delete the directory itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (delete-directory nnml-current-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; Remove the group from all structures.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
397 (setq nnml-group-alist
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (delq (assoc group nnml-group-alist) nnml-group-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 nnml-current-group nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 nnml-current-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;; Save the active file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (nnmail-save-active nnml-group-alist nnml-active-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (deffoo nnml-request-rename-group (group new-name &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (nnml-possibly-change-directory group server)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
407 (let ((new-dir (nnmail-group-pathname new-name nnml-directory))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
408 (old-dir (nnmail-group-pathname group nnml-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
409 (when (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
410 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
411 (make-directory new-dir t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
412 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
413 (error nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
414 ;; We move the articles file by file instead of renaming
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
415 ;; the directory -- there may be subgroups in this group.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
416 ;; One might be more clever, I guess.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
417 (let ((files (nnheader-article-to-file-alist old-dir)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
418 (while files
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
419 (rename-file
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
420 (concat old-dir (cdar files))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
421 (concat new-dir (cdar files)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
422 (pop files)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
423 ;; Move .overview file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
424 (let ((overview (concat old-dir nnml-nov-file-name)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
425 (when (file-exists-p overview)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
426 (rename-file overview (concat new-dir nnml-nov-file-name))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
427 (when (<= (length (directory-files old-dir)) 2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
428 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
429 (delete-directory old-dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
430 (error nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
431 ;; That went ok, so we change the internal structures.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
432 (let ((entry (assoc group nnml-group-alist)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
433 (when entry
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
434 (setcar entry new-name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
435 (setq nnml-current-directory nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
436 nnml-current-group nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
437 ;; Save the new group alist.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
438 (nnmail-save-active nnml-group-alist nnml-active-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
439 t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
440
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
441 (deffoo nnml-set-status (article name value &optional group server)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
442 (nnml-possibly-change-directory group server)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
443 (let ((file (nnml-article-to-file article)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
444 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
445 ((not (file-exists-p file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
446 (nnheader-report 'nnml "File %s does not exist" file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
447 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
448 (nnheader-temp-write file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
449 (nnheader-insert-file-contents file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
450 (nnmail-replace-status name value))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
451 t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 ;;; Internal functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
456 (defun nnml-article-to-file (article)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
457 (nnml-update-file-alist)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
458 (let (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
459 (when (setq file (cdr (assq article nnml-article-file-alist)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
460 (concat nnml-current-directory file))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
461
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defun nnml-deletable-article-p (group article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 "Say whether ARTICLE in GROUP can be deleted."
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
464 (let (path)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
465 (when (setq path (nnml-article-to-file article))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
466 (when (file-writable-p path)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
467 (or (not nnmail-keep-last-article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
468 (not (eq (cdr (nth 1 (assoc group nnml-group-alist)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
469 article)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
471 ;; Find an article number in the current group given the Message-ID.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defun nnml-find-group-number (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (set-buffer (get-buffer-create " *nnml id*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (let ((alist nnml-group-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; We want to look through all .overview files, but we want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;; start with the one in the current directory. It seems most
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
480 ;; likely that the article we are looking for is in that group.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (if (setq number (nnml-find-id nnml-current-group id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (cons nnml-current-group number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 ;; It wasn't there, so we look through the other groups as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (while (and (not number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (or (string= (caar alist) nnml-current-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (setq number (nnml-find-id (caar alist) id)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (or number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (setq alist (cdr alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (and number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (cons (caar alist) number))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (defun nnml-find-id (group id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (let ((nov (concat (nnmail-group-pathname group nnml-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 nnml-nov-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 number found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (when (file-exists-p nov)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
499 (nnheader-insert-file-contents nov)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
500 (while (and (not found)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (search-forward id nil t)) ; We find the ID.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ;; And the id is in the fourth field.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
503 (if (not (and (search-backward "\t" nil t 4)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
504 (not (search-backward"\t" (gnus-point-at-bol) t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
505 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
506 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
507 (setq found t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
508 ;; We return the article number.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
509 (setq number
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
510 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
511 (read (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
512 (error nil)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defun nnml-retrieve-headers-with-nov (articles &optional fetch-old)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (if (or gnus-nov-is-evil nnml-nov-is-evil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 nil
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
518 (let ((nov (concat nnml-current-directory nnml-nov-file-name)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (when (file-exists-p nov)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (erase-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
523 (nnheader-insert-file-contents nov)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (if (and fetch-old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (not (numberp fetch-old)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 t ; Don't remove anything.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
527 (nnheader-nov-delete-outside-range
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
528 (if fetch-old (max 1 (- (car articles) fetch-old))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
529 (car articles))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
530 (car (last articles)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 t))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (defun nnml-possibly-change-directory (group &optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (when (and server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (not (nnml-server-opened server)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (nnml-open-server server))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
537 (if (not group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
538 t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (let ((pathname (nnmail-group-pathname group nnml-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (when (not (equal pathname nnml-current-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (setq nnml-current-directory pathname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 nnml-current-group group
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
543 nnml-article-file-alist nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
544 (file-exists-p nnml-current-directory))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (defun nnml-possibly-create-directory (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (let (dir dirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (setq dir (nnmail-group-pathname group nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (while (not (file-directory-p dir))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
550 (push dir dirs)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (setq dir (file-name-directory (directory-file-name dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (while dirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (make-directory (directory-file-name (car dirs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (nnheader-message 5 "Creating mail directory %s" (car dirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (setq dirs (cdr dirs)))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
556
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
557 (defun nnml-save-mail (group-art)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 "Called narrowed to an article."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
559 (let (chars headers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (setq chars (nnmail-insert-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (nnmail-insert-xref group-art)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (run-hooks 'nnmail-prepare-save-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (run-hooks 'nnml-prepare-save-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (while (looking-at "From ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (replace-match "X-From-Line: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (forward-line 1))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
568 ;; We save the article in all the groups it belongs in.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (let ((ga group-art)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 first)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (while ga
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (nnml-possibly-create-directory (caar ga))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
573 (let ((file (concat (nnmail-group-pathname
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (caar ga) nnml-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (int-to-string (cdar ga)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (if first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ;; It was already saved, so we just make a hard link.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (funcall nnmail-crosspost-link-function first file t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; Save the article.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
580 (nnmail-write-region (point-min) (point-max) file nil
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
581 (if (nnheader-be-verbose 5) nil 'nomesg))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (setq first file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (setq ga (cdr ga))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
584 ;; Generate a nov line for this article. We generate the nov
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 ;; line after saving, because nov generation destroys the
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
586 ;; header.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (setq headers (nnml-parse-head chars))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 ;; Output the nov line to all nov databases that should have it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (let ((ga group-art))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (while ga
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (nnml-add-nov (caar ga) (cdar ga) headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (setq ga (cdr ga))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 group-art))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (defun nnml-active-number (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 "Compute the next article number in GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (let ((active (cadr (assoc group nnml-group-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;; The group wasn't known to nnml, so we just create an active
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
599 ;; entry for it.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (unless active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ;; Perhaps the active file was corrupt? See whether
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;; there are any articles in this group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (nnml-possibly-create-directory group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (nnml-possibly-change-directory group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (unless nnml-article-file-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq nnml-article-file-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (sort
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (nnheader-article-to-file-alist nnml-current-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (lambda (a1 a2) (< (car a1) (car a2))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (setq active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (if nnml-article-file-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (cons (caar nnml-article-file-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (caar (last nnml-article-file-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (cons 1 0)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
615 (push (list group active) nnml-group-alist))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (setcdr active (1+ (cdr active)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (while (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (concat (nnmail-group-pathname group nnml-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (int-to-string (cdr active))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (setcdr active (1+ (cdr active))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (cdr active)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (defun nnml-add-nov (group article headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 "Add a nov line for the GROUP base."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
625 (save-excursion
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (set-buffer (nnml-open-nov group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (mail-header-set-number headers article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (nnheader-insert-nov headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (defsubst nnml-header-value ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (buffer-substring (match-end 0) (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (defun nnml-parse-head (chars &optional number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 "Parse the head of the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
639 (narrow-to-region
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (1- (or (search-forward "\n\n" nil t) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 ;; Fold continuation lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (replace-match " " t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ;; Remove any tabs; they are too confusing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (subst-char-in-region (point-min) (point-max) ?\t ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (let ((headers (nnheader-parse-head t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (mail-header-set-chars headers chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (mail-header-set-number headers number)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 headers))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (defun nnml-open-nov (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (or (cdr (assoc group nnml-nov-buffer-alist))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
655 (let ((buffer (nnheader-find-file-noselect
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (concat (nnmail-group-pathname group nnml-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 nnml-nov-file-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (buffer-disable-undo (current-buffer)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
661 (push (cons group buffer) nnml-nov-buffer-alist)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (defun nnml-save-nov ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (while nnml-nov-buffer-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (when (buffer-name (cdar nnml-nov-buffer-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (set-buffer (cdar nnml-nov-buffer-alist))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
669 (when (buffer-modified-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
670 (nnmail-write-region 1 (point-max) (buffer-file-name) nil 'nomesg))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (setq nnml-nov-buffer-alist (cdr nnml-nov-buffer-alist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (defun nnml-generate-nov-databases ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
677 "Generate nov databases in all nnml directories."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (interactive)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
679 ;; Read the active file to make sure we don't re-use articles
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;; numbers in empty groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (nnmail-activate 'nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (nnml-open-server (or (nnoo-current-server 'nnml) ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (setq nnml-directory (expand-file-name nnml-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;; Recurse down the directories.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 42
diff changeset
685 (nnml-generate-nov-databases-1 nnml-directory)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; Save the active file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (nnmail-save-active nnml-group-alist nnml-active-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
689 (defun nnml-generate-nov-databases-1 (dir &optional seen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (setq dir (file-name-as-directory dir))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
691 ;; Only scan this sub-tree if we haven't been here yet.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
692 (unless (member (file-truename dir) seen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
693 (push (file-truename dir) seen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
694 ;; We descend recursively
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
695 (let ((dirs (directory-files dir t nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
696 dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
697 (while (setq dir (pop dirs))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
698 (when (and (not (member (file-name-nondirectory dir) '("." "..")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
699 (file-directory-p dir))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
700 (nnml-generate-nov-databases-1 dir seen))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
701 ;; Do this directory.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
702 (let ((files (sort (nnheader-article-to-file-alist dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
703 (lambda (a b) (< (car a) (car b))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
704 (when files
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
705 (funcall nnml-generate-active-function dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
706 ;; Generate the nov file.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
707 (nnml-generate-nov-file dir files)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (defvar files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (defun nnml-generate-active-info (dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ;; Update the active info for this group.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
712 (let ((group (nnheader-file-to-group
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (directory-file-name dir) nnml-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (setq nnml-group-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (delq (assoc group nnml-group-alist) nnml-group-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (push (list group
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
717 (cons (caar files)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (let ((f files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (while (cdr f) (setq f (cdr f)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
720 (caar f))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 nnml-group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (defun nnml-generate-nov-file (dir files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (let* ((dir (file-name-as-directory dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (nov (concat dir nnml-nov-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (nov-buffer (get-buffer-create " *nov*"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
727 chars file headers)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 ;; Init the nov buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (set-buffer nov-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 ;; Delete the old NOV file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (when (file-exists-p nov)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (funcall nnmail-delete-file-function nov))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (while files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
738 (unless (file-directory-p (setq file (concat dir (cdar files))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (erase-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
740 (nnheader-insert-file-contents file)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
741 (narrow-to-region
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (setq chars (- (point-max) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (max 1 (1- (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (when (and (not (= 0 chars)) ; none of them empty files...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (not (= (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
750 (setq headers (nnml-parse-head chars (caar files)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (set-buffer nov-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (nnheader-insert-nov headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (setq files (cdr files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (set-buffer nov-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
759 (nnmail-write-region 1 (point-max) nov nil 'nomesg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (kill-buffer (current-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (defun nnml-nov-delete-article (group article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (set-buffer (nnml-open-nov group))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
765 (when (nnheader-find-nov-line article)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
766 (delete-region (point) (progn (forward-line 1) (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
767 (when (bobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
768 (let ((active (cadr (assoc group nnml-group-alist)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
769 num)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
770 (when active
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
771 (if (eobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
772 (setf (car active) (1+ (cdr active)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
773 (when (and (setq num (ignore-errors (read (current-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
774 (numberp num))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
775 (setf (car active) num)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
778 (defun nnml-update-file-alist ()
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
779 (unless nnml-article-file-alist
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
780 (setq nnml-article-file-alist
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
781 (nnheader-article-to-file-alist nnml-current-directory))))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
782
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (provide 'nnml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 ;;; nnml.el ends here