Mercurial > emacs
annotate lisp/gnus/nnmbox.el @ 112121:a51d791afefe
ChangeLog fix.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 04 Jan 2011 23:03:21 -0800 |
parents | 42815c76b976 |
children | 417b1e4d63cd |
rev | line source |
---|---|
17493 | 1 ;;; nnmbox.el --- mail mbox access for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
106815 | 4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
7 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> |
17493 | 8 ;; Keywords: news, mail |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
17493 | 13 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
20 ;; GNU General Public License for more details. |
17493 | 21 |
22 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; For an overview of what the interface functions do, please see the | |
28 ;; Gnus sources. | |
29 | |
30 ;;; Code: | |
31 | |
32 (require 'nnheader) | |
33 (require 'message) | |
34 (require 'nnmail) | |
35 (require 'nnoo) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
36 (require 'gnus-range) |
17493 | 37 (eval-when-compile (require 'cl)) |
38 | |
39 (nnoo-declare nnmbox) | |
40 | |
41 (defvoo nnmbox-mbox-file (expand-file-name "~/mbox") | |
42 "The name of the mail box file in the user's home directory.") | |
43 | |
44 (defvoo nnmbox-active-file (expand-file-name "~/.mbox-active") | |
45 "The name of the active file for the mail box.") | |
46 | |
47 (defvoo nnmbox-get-new-mail t | |
48 "If non-nil, nnmbox will check the incoming mail file and split the mail.") | |
49 | |
50 (defvoo nnmbox-prepare-save-mail-hook nil | |
51 "Hook run narrowed to an article before saving.") | |
52 | |
53 | |
54 | |
55 (defconst nnmbox-version "nnmbox 1.0" | |
56 "nnmbox version.") | |
57 | |
58 (defvoo nnmbox-current-group nil | |
59 "Current nnmbox news group directory.") | |
60 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
61 (defvar nnmbox-mbox-buffer nil) |
17493 | 62 |
63 (defvoo nnmbox-status-string "") | |
64 | |
65 (defvoo nnmbox-group-alist nil) | |
66 (defvoo nnmbox-active-timestamp nil) | |
67 | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
31716
diff
changeset
|
68 (defvoo nnmbox-file-coding-system mm-binary-coding-system) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
69 (defvoo nnmbox-file-coding-system-for-write nil) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
31716
diff
changeset
|
70 (defvoo nnmbox-active-file-coding-system mm-binary-coding-system) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
71 (defvoo nnmbox-active-file-coding-system-for-write nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
72 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
73 (defvar nnmbox-group-building-active-articles nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
74 (defvar nnmbox-group-active-articles nil) |
17493 | 75 |
76 | |
77 ;;; Interface functions | |
78 | |
79 (nnoo-define-basics nnmbox) | |
80 | |
81 (deffoo nnmbox-retrieve-headers (sequence &optional newsgroup server fetch-old) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
82 (with-current-buffer nntp-server-buffer |
17493 | 83 (erase-buffer) |
84 (let ((number (length sequence)) | |
85 (count 0) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
86 article start stop) |
17493 | 87 (nnmbox-possibly-change-newsgroup newsgroup server) |
88 (while sequence | |
89 (setq article (car sequence)) | |
90 (set-buffer nnmbox-mbox-buffer) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
91 (when (nnmbox-find-article article) |
17493 | 92 (setq start |
93 (save-excursion | |
94 (re-search-backward | |
95 (concat "^" message-unix-mail-delimiter) nil t) | |
96 (point))) | |
97 (search-forward "\n\n" nil t) | |
98 (setq stop (1- (point))) | |
99 (set-buffer nntp-server-buffer) | |
100 (insert (format "221 %d Article retrieved.\n" article)) | |
101 (insert-buffer-substring nnmbox-mbox-buffer start stop) | |
102 (goto-char (point-max)) | |
103 (insert ".\n")) | |
104 (setq sequence (cdr sequence)) | |
105 (setq count (1+ count)) | |
106 (and (numberp nnmail-large-newsgroup) | |
107 (> number nnmail-large-newsgroup) | |
108 (zerop (% count 20)) | |
109 (nnheader-message 5 "nnmbox: Receiving headers... %d%%" | |
110 (/ (* count 100) number)))) | |
111 | |
112 (and (numberp nnmail-large-newsgroup) | |
113 (> number nnmail-large-newsgroup) | |
114 (nnheader-message 5 "nnmbox: Receiving headers...done")) | |
115 | |
116 (set-buffer nntp-server-buffer) | |
117 (nnheader-fold-continuation-lines) | |
118 'headers))) | |
119 | |
120 (deffoo nnmbox-open-server (server &optional defs) | |
121 (nnoo-change-server 'nnmbox server defs) | |
122 (nnmbox-create-mbox) | |
123 (cond | |
124 ((not (file-exists-p nnmbox-mbox-file)) | |
125 (nnmbox-close-server) | |
126 (nnheader-report 'nnmbox "No such file: %s" nnmbox-mbox-file)) | |
127 ((file-directory-p nnmbox-mbox-file) | |
128 (nnmbox-close-server) | |
129 (nnheader-report 'nnmbox "Not a regular file: %s" nnmbox-mbox-file)) | |
130 (t | |
131 (nnheader-report 'nnmbox "Opened server %s using mbox %s" server | |
132 nnmbox-mbox-file) | |
133 t))) | |
134 | |
135 (deffoo nnmbox-close-server (&optional server) | |
136 (when (and nnmbox-mbox-buffer | |
137 (buffer-name nnmbox-mbox-buffer)) | |
138 (kill-buffer nnmbox-mbox-buffer)) | |
139 (nnoo-close-server 'nnmbox server) | |
140 t) | |
141 | |
142 (deffoo nnmbox-server-opened (&optional server) | |
143 (and (nnoo-current-server-p 'nnmbox server) | |
144 nnmbox-mbox-buffer | |
145 (buffer-name nnmbox-mbox-buffer) | |
146 nntp-server-buffer | |
147 (buffer-name nntp-server-buffer))) | |
148 | |
149 (deffoo nnmbox-request-article (article &optional newsgroup server buffer) | |
150 (nnmbox-possibly-change-newsgroup newsgroup server) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
151 (with-current-buffer nnmbox-mbox-buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
152 (when (nnmbox-find-article article) |
17493 | 153 (let (start stop) |
154 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) | |
155 (setq start (point)) | |
156 (forward-line 1) | |
79022 | 157 (setq stop (if (re-search-forward (concat "^" |
158 message-unix-mail-delimiter) | |
159 nil 'move) | |
160 (match-beginning 0) | |
161 (point))) | |
17493 | 162 (let ((nntp-server-buffer (or buffer nntp-server-buffer))) |
163 (set-buffer nntp-server-buffer) | |
164 (erase-buffer) | |
165 (insert-buffer-substring nnmbox-mbox-buffer start stop) | |
166 (goto-char (point-min)) | |
167 (while (looking-at "From ") | |
168 (delete-char 5) | |
169 (insert "X-From-Line: ") | |
170 (forward-line 1)) | |
171 (if (numberp article) | |
172 (cons nnmbox-current-group article) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
173 (nnmbox-article-group-number nil))))))) |
17493 | 174 |
110422
93e093c035a0
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
175 (deffoo nnmbox-request-group (group &optional server dont-check info) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
176 (nnmbox-possibly-change-newsgroup nil server) |
17493 | 177 (let ((active (cadr (assoc group nnmbox-group-alist)))) |
178 (cond | |
179 ((or (null active) | |
180 (null (nnmbox-possibly-change-newsgroup group server))) | |
181 (nnheader-report 'nnmbox "No such group: %s" group)) | |
182 (dont-check | |
183 (nnheader-report 'nnmbox "Selected group %s" group) | |
184 (nnheader-insert "")) | |
185 (t | |
186 (nnheader-report 'nnmbox "Selected group %s" group) | |
187 (nnheader-insert "211 %d %d %d %s\n" | |
188 (1+ (- (cdr active) (car active))) | |
189 (car active) (cdr active) group))))) | |
190 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
191 (defun nnmbox-save-buffer () |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47002
diff
changeset
|
192 (let ((coding-system-for-write |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
193 (or nnmbox-file-coding-system-for-write |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
194 nnmbox-file-coding-system))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
195 (save-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
196 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
197 (defun nnmbox-save-active (group-alist active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
198 (let ((nnmail-active-file-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
199 (or nnmbox-active-file-coding-system-for-write |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
200 nnmbox-active-file-coding-system))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
201 (nnmail-save-active group-alist active-file))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
202 |
17493 | 203 (deffoo nnmbox-request-scan (&optional group server) |
204 (nnmbox-possibly-change-newsgroup group server) | |
205 (nnmbox-read-mbox) | |
206 (nnmail-get-new-mail | |
207 'nnmbox | |
208 (lambda () | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
209 (with-current-buffer nnmbox-mbox-buffer |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
210 (nnmbox-save-buffer))) |
17493 | 211 (file-name-directory nnmbox-mbox-file) |
212 group | |
213 (lambda () | |
214 (save-excursion | |
215 (let ((in-buf (current-buffer))) | |
216 (set-buffer nnmbox-mbox-buffer) | |
217 (goto-char (point-max)) | |
218 (insert-buffer-substring in-buf))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
219 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file)))) |
17493 | 220 |
221 (deffoo nnmbox-close-group (group &optional server) | |
222 t) | |
223 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
224 (deffoo nnmbox-request-create-group (group &optional server args) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
225 (nnmail-activate 'nnmbox) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
226 (unless (assoc group nnmbox-group-alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
227 (push (list group (cons 1 0)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
228 nnmbox-group-alist) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
229 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
230 t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
231 |
17493 | 232 (deffoo nnmbox-request-list (&optional server) |
233 (save-excursion | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
234 (let ((nnmail-file-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
235 nnmbox-active-file-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
236 (nnmail-find-file nnmbox-active-file)) |
17493 | 237 (setq nnmbox-group-alist (nnmail-get-active)) |
238 t)) | |
239 | |
240 (deffoo nnmbox-request-newgroups (date &optional server) | |
241 (nnmbox-request-list server)) | |
242 | |
243 (deffoo nnmbox-request-list-newsgroups (&optional server) | |
244 (nnheader-report 'nnmbox "LIST NEWSGROUPS is not implemented.")) | |
245 | |
246 (deffoo nnmbox-request-expire-articles | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
247 (articles newsgroup &optional server force) |
17493 | 248 (nnmbox-possibly-change-newsgroup newsgroup server) |
249 (let* ((is-old t) | |
250 rest) | |
251 (nnmail-activate 'nnmbox) | |
252 | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
253 (with-current-buffer nnmbox-mbox-buffer |
17493 | 254 (while (and articles is-old) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (when (nnmbox-find-article (car articles)) |
17493 | 256 (if (setq is-old |
257 (nnmail-expired-article-p | |
258 newsgroup | |
259 (buffer-substring | |
260 (point) (progn (end-of-line) (point))) force)) | |
261 (progn | |
47002
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44511
diff
changeset
|
262 (unless (eq nnmail-expiry-target 'delete) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44511
diff
changeset
|
263 (with-temp-buffer |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47002
diff
changeset
|
264 (nnmbox-request-article (car articles) |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47002
diff
changeset
|
265 newsgroup server |
47002
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44511
diff
changeset
|
266 (current-buffer)) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44511
diff
changeset
|
267 (let ((nnml-current-directory nil)) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44511
diff
changeset
|
268 (nnmail-expiry-target-group |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
269 nnmail-expiry-target newsgroup))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
270 (nnmbox-possibly-change-newsgroup newsgroup server)) |
17493 | 271 (nnheader-message 5 "Deleting article %d in %s..." |
272 (car articles) newsgroup) | |
273 (nnmbox-delete-mail)) | |
274 (push (car articles) rest))) | |
275 (setq articles (cdr articles))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
276 (nnmbox-save-buffer) |
17493 | 277 ;; Find the lowest active article in this group. |
278 (let ((active (nth 1 (assoc newsgroup nnmbox-group-alist)))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
279 (while (and (not (nnmbox-find-article (car active))) |
17493 | 280 (<= (car active) (cdr active))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
281 (setcar active (1+ (car active))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
282 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file) |
17493 | 283 (nconc rest articles)))) |
284 | |
285 (deffoo nnmbox-request-move-article | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79022
diff
changeset
|
286 (article group server accept-form &optional last move-is-internal) |
17493 | 287 (let ((buf (get-buffer-create " *nnmbox move*")) |
288 result) | |
289 (and | |
290 (nnmbox-request-article article group server) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
291 (with-current-buffer buf |
17493 | 292 (erase-buffer) |
293 (insert-buffer-substring nntp-server-buffer) | |
294 (goto-char (point-min)) | |
295 (while (re-search-forward | |
296 "^X-Gnus-Newsgroup:" | |
297 (save-excursion (search-forward "\n\n" nil t) (point)) t) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
298 (gnus-delete-line)) |
17493 | 299 (setq result (eval accept-form)) |
300 (kill-buffer buf) | |
301 result) | |
302 (save-excursion | |
303 (nnmbox-possibly-change-newsgroup group server) | |
304 (set-buffer nnmbox-mbox-buffer) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
305 (when (nnmbox-find-article article) |
17493 | 306 (nnmbox-delete-mail)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 (and last (nnmbox-save-buffer)))) |
17493 | 308 result)) |
309 | |
310 (deffoo nnmbox-request-accept-article (group &optional server last) | |
311 (nnmbox-possibly-change-newsgroup group server) | |
312 (nnmail-check-syntax) | |
313 (let ((buf (current-buffer)) | |
79022 | 314 result cont) |
17493 | 315 (and |
316 (nnmail-activate 'nnmbox) | |
79022 | 317 (with-temp-buffer |
318 (insert-buffer-substring buf) | |
17493 | 319 (goto-char (point-min)) |
79022 | 320 (cond (;; The From line may have been quoted by movemail. |
321 (looking-at (concat ">" message-unix-mail-delimiter)) | |
322 (delete-char 1) | |
323 (forward-line 1)) | |
324 ((looking-at "X-From-Line: ") | |
325 (replace-match "From ") | |
326 (forward-line 1)) | |
327 (t | |
328 (insert "From nobody " (current-time-string) "\n"))) | |
329 (narrow-to-region (point) | |
330 (if (search-forward "\n\n" nil 'move) | |
331 (1- (point)) | |
332 (point))) | |
17493 | 333 (while (re-search-backward "^X-Gnus-Newsgroup: " nil t) |
334 (delete-region (point) (progn (forward-line 1) (point)))) | |
335 (when nnmail-cache-accepted-message-ids | |
79022 | 336 (nnmail-cache-insert (message-fetch-field "message-id") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
337 group |
79022 | 338 (message-fetch-field "subject") |
339 (message-fetch-field "from"))) | |
340 (widen) | |
17493 | 341 (setq result (if (stringp group) |
342 (list (cons group (nnmbox-active-number group))) | |
343 (nnmail-article-group 'nnmbox-active-number))) | |
79022 | 344 (prog1 |
345 (if (and (null result) | |
346 (yes-or-no-p "Moved to `junk' group; delete article? ")) | |
347 (setq result 'junk) | |
348 (setq result (car (nnmbox-save-mail result)))) | |
349 (setq cont (buffer-string)))) | |
350 (with-current-buffer nnmbox-mbox-buffer | |
17493 | 351 (goto-char (point-max)) |
79022 | 352 (insert cont) |
17493 | 353 (when last |
354 (when nnmail-cache-accepted-message-ids | |
355 (nnmail-cache-close)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
356 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
357 (nnmbox-save-buffer)))) |
17493 | 358 result)) |
359 | |
360 (deffoo nnmbox-request-replace-article (article group buffer) | |
361 (nnmbox-possibly-change-newsgroup group) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
362 (with-current-buffer nnmbox-mbox-buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
363 (if (not (nnmbox-find-article article)) |
17493 | 364 nil |
365 (nnmbox-delete-mail t t) | |
79022 | 366 (insert |
367 (with-temp-buffer | |
368 (insert-buffer-substring buffer) | |
369 (goto-char (point-min)) | |
370 (when (looking-at "X-From-Line:") | |
371 (delete-region (point) (progn (forward-line 1) (point)))) | |
372 (while (re-search-forward (concat "^" message-unix-mail-delimiter) | |
373 nil t) | |
374 (goto-char (match-beginning 0)) | |
375 (insert ">")) | |
376 (goto-char (point-max)) | |
377 (unless (bolp) | |
378 (insert "\n")) | |
379 (buffer-string))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
380 (nnmbox-save-buffer) |
17493 | 381 t))) |
382 | |
383 (deffoo nnmbox-request-delete-group (group &optional force server) | |
384 (nnmbox-possibly-change-newsgroup group server) | |
385 ;; Delete all articles in GROUP. | |
386 (if (not force) | |
387 () ; Don't delete the articles. | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
388 (with-current-buffer nnmbox-mbox-buffer |
17493 | 389 (goto-char (point-min)) |
390 ;; Delete all articles in this group. | |
391 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) | |
392 found) | |
393 (while (search-forward ident nil t) | |
394 (setq found t) | |
395 (nnmbox-delete-mail)) | |
396 (when found | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
397 (nnmbox-save-buffer))))) |
17493 | 398 ;; Remove the group from all structures. |
399 (setq nnmbox-group-alist | |
400 (delq (assoc group nnmbox-group-alist) nnmbox-group-alist) | |
401 nnmbox-current-group nil) | |
402 ;; Save the active file. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
403 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file) |
17493 | 404 t) |
405 | |
406 (deffoo nnmbox-request-rename-group (group new-name &optional server) | |
407 (nnmbox-possibly-change-newsgroup group server) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
408 (with-current-buffer nnmbox-mbox-buffer |
17493 | 409 (goto-char (point-min)) |
410 (let ((ident (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":")) | |
411 (new-ident (concat "\nX-Gnus-Newsgroup: " new-name ":")) | |
412 found) | |
413 (while (search-forward ident nil t) | |
414 (replace-match new-ident t t) | |
415 (setq found t)) | |
416 (when found | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
417 (nnmbox-save-buffer)))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
418 (let ((entry (assoc group nnmbox-group-active-articles))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
419 (when entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
420 (setcar entry new-name))) |
17493 | 421 (let ((entry (assoc group nnmbox-group-alist))) |
422 (when entry | |
423 (setcar entry new-name)) | |
424 (setq nnmbox-current-group nil) | |
425 ;; Save the new group alist. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
426 (nnmbox-save-active nnmbox-group-alist nnmbox-active-file) |
17493 | 427 t)) |
428 | |
429 | |
430 ;;; Internal functions. | |
431 | |
432 ;; If FORCE, delete article no matter how many X-Gnus-Newsgroup | |
433 ;; headers there are. If LEAVE-DELIM, don't delete the Unix mbox | |
434 ;; delimiter line. | |
435 (defun nnmbox-delete-mail (&optional force leave-delim) | |
436 ;; Delete the current X-Gnus-Newsgroup line. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
437 ;; First delete record of active article, unless the article is being |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
438 ;; replaced, indicated by FORCE being non-nil. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
439 (if (not force) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
440 (nnmbox-record-deleted-article (nnmbox-article-group-number t))) |
17493 | 441 (or force |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
442 (gnus-delete-line)) |
17493 | 443 ;; Beginning of the article. |
444 (save-excursion | |
445 (save-restriction | |
446 (narrow-to-region | |
79022 | 447 (prog2 |
448 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) | |
449 (if leave-delim (progn (forward-line 1) (point)) | |
450 (match-beginning 0)) | |
451 (forward-line 1)) | |
452 (or (and (re-search-forward (concat "^" message-unix-mail-delimiter) | |
453 nil t) | |
454 (match-beginning 0)) | |
455 (point-max))) | |
17493 | 456 (goto-char (point-min)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
457 ;; Only delete the article if no other group owns it as well. |
79022 | 458 (when (or force |
459 (not (re-search-forward "^X-Gnus-Newsgroup: " nil t)) | |
460 (search-backward "\n\n" nil t)) | |
17493 | 461 (delete-region (point-min) (point-max)))))) |
462 | |
463 (defun nnmbox-possibly-change-newsgroup (newsgroup &optional server) | |
464 (when (and server | |
465 (not (nnmbox-server-opened server))) | |
466 (nnmbox-open-server server)) | |
467 (when (or (not nnmbox-mbox-buffer) | |
468 (not (buffer-name nnmbox-mbox-buffer))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
469 (nnmbox-read-mbox)) |
17493 | 470 (when (not nnmbox-group-alist) |
471 (nnmail-activate 'nnmbox)) | |
472 (if newsgroup | |
473 (when (assoc newsgroup nnmbox-group-alist) | |
474 (setq nnmbox-current-group newsgroup)) | |
475 t)) | |
476 | |
477 (defun nnmbox-article-string (article) | |
478 (if (numberp article) | |
479 (concat "\nX-Gnus-Newsgroup: " nnmbox-current-group ":" | |
480 (int-to-string article) " ") | |
481 (concat "\nMessage-ID: " article))) | |
482 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
483 (defun nnmbox-article-group-number (this-line) |
17493 | 484 (save-excursion |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
485 (if this-line |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
486 (beginning-of-line) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
487 (goto-char (point-min))) |
17493 | 488 (when (re-search-forward "^X-Gnus-Newsgroup: +\\([^:]+\\):\\([0-9]+\\) " |
489 nil t) | |
490 (cons (buffer-substring (match-beginning 1) (match-end 1)) | |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
491 (string-to-number |
17493 | 492 (buffer-substring (match-beginning 2) (match-end 2))))))) |
493 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
494 (defun nnmbox-in-header-p (pos) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
495 "Return non-nil if POS is in the header of an article." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
496 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
497 (goto-char pos) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
498 (re-search-backward (concat "^" message-unix-mail-delimiter) nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
499 (search-forward "\n\n" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
500 (< pos (point)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
501 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
502 (defun nnmbox-find-article (article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
503 "Leaves point on the relevant X-Gnus-Newsgroup line if found." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
504 ;; Check that article is in the active range first, to avoid an |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
505 ;; expensive exhaustive search if it isn't. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
506 (if (and (numberp article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
507 (not (nnmbox-is-article-active-p article))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
508 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
509 (let ((art-string (nnmbox-article-string article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
510 (found nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
511 ;; There is the possibility that the X-Gnus-Newsgroup line appears |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
512 ;; in the body of an article (for instance, if an article has been |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
513 ;; forwarded from someone using Gnus as their mailer), so check |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
514 ;; that the line is actually part of the article header. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
515 (or (and (search-forward art-string nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
516 (nnmbox-in-header-p (point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
517 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
518 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
519 (while (and (not found) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
520 (search-forward art-string nil t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
521 (setq found (nnmbox-in-header-p (point)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
522 found))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
523 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
524 (defun nnmbox-record-active-article (group-art) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
525 (let* ((group (car group-art)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
526 (article (cdr group-art)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
527 (entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
528 (or (assoc group nnmbox-group-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
529 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
530 (push (list group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
531 nnmbox-group-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
532 (car nnmbox-group-active-articles))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
533 ;; add article to index, either by building complete list |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
534 ;; in reverse order, or as a list of ranges. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
535 (if (not nnmbox-group-building-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
536 (setcdr entry (gnus-add-to-range (cdr entry) (list article))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
537 (when (memq article (cdr entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
538 (switch-to-buffer nnmbox-mbox-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
539 (error "Article %s:%d already exists!" group article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
540 (when (and (cadr entry) (< article (cadr entry))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
541 (switch-to-buffer nnmbox-mbox-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
542 (error "Article %s:%d out of order" group article)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
543 (setcdr entry (cons article (cdr entry)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
544 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
545 (defun nnmbox-record-deleted-article (group-art) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
546 (let* ((group (car group-art)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
547 (article (cdr group-art)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
548 (entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
549 (or (assoc group nnmbox-group-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
550 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
551 (push (list group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
552 nnmbox-group-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
553 (car nnmbox-group-active-articles))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
554 ;; remove article from index |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
555 (setcdr entry (gnus-remove-from-range (cdr entry) (list article))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
556 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
557 (defun nnmbox-is-article-active-p (article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
558 (gnus-member-of-range |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
559 article |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
560 (cdr (assoc nnmbox-current-group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
561 nnmbox-group-active-articles)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
562 |
17493 | 563 (defun nnmbox-save-mail (group-art) |
564 "Called narrowed to an article." | |
565 (let ((delim (concat "^" message-unix-mail-delimiter))) | |
566 (goto-char (point-min)) | |
567 ;; This might come from somewhere else. | |
79022 | 568 (if (looking-at delim) |
569 (forward-line 1) | |
570 (insert "From nobody " (current-time-string) "\n")) | |
17493 | 571 ;; Quote all "From " lines in the article. |
572 (while (re-search-forward delim nil t) | |
79022 | 573 (goto-char (match-beginning 0)) |
574 (insert ">"))) | |
575 (goto-char (point-max)) | |
576 (unless (bolp) | |
577 (insert "\n")) | |
578 (nnmail-insert-lines) | |
579 (nnmail-insert-xref group-art) | |
580 (nnmbox-insert-newsgroup-line group-art) | |
581 (let ((alist group-art)) | |
582 (while alist | |
583 (nnmbox-record-active-article (car alist)) | |
584 (setq alist (cdr alist)))) | |
585 (run-hooks 'nnmail-prepare-save-mail-hook) | |
586 (run-hooks 'nnmbox-prepare-save-mail-hook) | |
587 group-art) | |
17493 | 588 |
589 (defun nnmbox-insert-newsgroup-line (group-art) | |
590 (save-excursion | |
591 (goto-char (point-min)) | |
592 (when (search-forward "\n\n" nil t) | |
593 (forward-char -1) | |
594 (while group-art | |
595 (insert (format "X-Gnus-Newsgroup: %s:%d %s\n" | |
596 (caar group-art) (cdar group-art) | |
597 (current-time-string))) | |
598 (setq group-art (cdr group-art)))) | |
599 t)) | |
600 | |
601 (defun nnmbox-active-number (group) | |
602 ;; Find the next article number in GROUP. | |
603 (let ((active (cadr (assoc group nnmbox-group-alist)))) | |
604 (if active | |
605 (setcdr active (1+ (cdr active))) | |
606 ;; This group is new, so we create a new entry for it. | |
607 ;; This might be a bit naughty... creating groups on the drop of | |
608 ;; a hat, but I don't know... | |
609 (push (list group (setq active (cons 1 1))) | |
610 nnmbox-group-alist)) | |
611 (cdr active))) | |
612 | |
613 (defun nnmbox-create-mbox () | |
614 (when (not (file-exists-p nnmbox-mbox-file)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
615 (let ((nnmail-file-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
616 (or nnmbox-file-coding-system-for-write |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
617 nnmbox-file-coding-system)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
618 (dir (file-name-directory nnmbox-mbox-file))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
619 (and dir (gnus-make-directory dir)) |
44511
5c5bc6fd4eb8
(nnmbox-create-mbox): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34752
diff
changeset
|
620 (nnmail-write-region (point-min) (point-min) |
5c5bc6fd4eb8
(nnmbox-create-mbox): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34752
diff
changeset
|
621 nnmbox-mbox-file t 'nomesg)))) |
17493 | 622 |
623 (defun nnmbox-read-mbox () | |
624 (nnmail-activate 'nnmbox) | |
625 (nnmbox-create-mbox) | |
626 (if (and nnmbox-mbox-buffer | |
627 (buffer-name nnmbox-mbox-buffer) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
628 (with-current-buffer nnmbox-mbox-buffer |
17493 | 629 (= (buffer-size) (nnheader-file-size nnmbox-mbox-file)))) |
630 () | |
631 (save-excursion | |
632 (let ((delim (concat "^" message-unix-mail-delimiter)) | |
633 (alist nnmbox-group-alist) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
634 (nnmbox-group-building-active-articles t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
635 start end end-header number) |
17493 | 636 (set-buffer (setq nnmbox-mbox-buffer |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
637 (let ((nnheader-file-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
638 nnmbox-file-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
639 (nnheader-find-file-noselect |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
640 nnmbox-mbox-file t t)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
641 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
642 (buffer-disable-undo) |
110689
42815c76b976
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110422
diff
changeset
|
643 (gnus-add-buffer) |
17493 | 644 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
645 ;; Go through the group alist and compare against the mbox file. |
17493 | 646 (while alist |
647 (goto-char (point-max)) | |
648 (when (and (re-search-backward | |
649 (format "^X-Gnus-Newsgroup: %s:\\([0-9]+\\) " | |
650 (caar alist)) nil t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
651 (> (setq number |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
652 (string-to-number |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
653 (buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
654 (match-beginning 1) (match-end 1)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
655 (cdadar alist))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
656 (setcdr (cadar alist) number)) |
17493 | 657 (setq alist (cdr alist))) |
658 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
659 ;; Examine all articles for our private X-Gnus-Newsgroup |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
660 ;; headers. This is done primarily as a consistency check, but |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
661 ;; it is convenient for building an index of the articles |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
662 ;; present, to avoid costly searches for missing articles |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
663 ;; (eg. when expiring articles). |
17493 | 664 (goto-char (point-min)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
665 (setq nnmbox-group-active-articles nil) |
17493 | 666 (while (re-search-forward delim nil t) |
667 (setq start (match-beginning 0)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
668 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
669 (search-forward "\n\n" nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
670 (setq end-header (point)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
671 (setq end (or (and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
672 (re-search-forward delim nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
673 (match-beginning 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
674 (point-max)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
675 (if (search-forward "\nX-Gnus-Newsgroup: " end-header t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
676 ;; Build a list of articles in each group, remembering |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
677 ;; that each article may be in more than one group. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
678 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
679 (nnmbox-record-active-article (nnmbox-article-group-number t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
680 (while (search-forward "\nX-Gnus-Newsgroup: " end-header t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
681 (nnmbox-record-active-article (nnmbox-article-group-number t)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
682 ;; The article is either new, or for some other reason |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
683 ;; hasn't got our private headers, so add them now. The |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
684 ;; only situation I've encountered when the X-Gnus-Newsgroup |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
685 ;; header is missing is if the article contains a forwarded |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
686 ;; message which does contain that header line (earlier |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
687 ;; versions of Gnus didn't restrict their search to the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
688 ;; headers). In this case, there is an Xref line which |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
689 ;; provides the relevant information to construct the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
690 ;; missing header(s). |
17493 | 691 (save-excursion |
692 (save-restriction | |
693 (narrow-to-region start end) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
694 (if (re-search-forward "\nXref: [^ ]+" end-header t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
695 ;; generate headers from Xref: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
696 (let (alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
697 (while (re-search-forward " \\([^:]+\\):\\([0-9]+\\)" end-header t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
698 (push (cons (match-string 1) |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
699 (string-to-number (match-string 2))) alist)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
700 (nnmbox-insert-newsgroup-line alist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
701 ;; this is really a new article |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
702 (nnmbox-save-mail |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
703 (nnmail-article-group 'nnmbox-active-number)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
704 (goto-char end)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
705 ;; put article lists in order |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
706 (setq alist nnmbox-group-active-articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
707 (while alist |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
708 (setcdr (car alist) (gnus-compress-sequence (nreverse (cdar alist)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
709 (setq alist (cdr alist))))))) |
17493 | 710 |
711 (provide 'nnmbox) | |
712 | |
713 ;;; nnmbox.el ends here |