Mercurial > emacs
annotate lisp/gnus/nnfolder.el @ 47026:bacfdb9ae69d
Fix last change.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Sat, 24 Aug 2002 18:35:58 +0000 |
parents | b87254142b98 |
children | eb2699620e9c |
rev | line source |
---|---|
17493 | 1 ;;; nnfolder.el --- mail folder access for Gnus |
38382
36083635b0c6
(nnfolder-read-folder): Force to use a multibyte buffer.
Gerd Moellmann <gerd@gnu.org>
parents:
32193
diff
changeset
|
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
17493 | 4 |
5 ;; Author: Scott Byer <byer@mv.us.adobe.com> | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
6 ;; Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> |
8 ;; Keywords: mail | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;;; Code: | |
30 | |
31 (require 'nnheader) | |
32 (require 'message) | |
33 (require 'nnmail) | |
34 (require 'nnoo) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
35 (eval-when-compile (require 'cl)) |
17493 | 36 (require 'gnus-util) |
47002
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
37 (require 'gnus-range) |
17493 | 38 |
39 (nnoo-declare nnfolder) | |
40 | |
41 (defvoo nnfolder-directory (expand-file-name message-directory) | |
42 "The name of the nnfolder directory.") | |
43 | |
44 (defvoo nnfolder-active-file | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
45 (nnheader-concat nnfolder-directory "active") |
17493 | 46 "The name of the active file.") |
47 | |
48 ;; I renamed this variable to something more in keeping with the general GNU | |
49 ;; style. -SLB | |
50 | |
51 (defvoo nnfolder-ignore-active-file nil | |
32193
99d97831a467
(nnfolder-ignore-active-file): Typos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31716
diff
changeset
|
52 "If non-nil, the active file is ignored. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
53 This causes nnfolder to do some extra work in order to determine the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
54 true active ranges of an mbox file. Note that the active file is |
32193
99d97831a467
(nnfolder-ignore-active-file): Typos.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31716
diff
changeset
|
55 still saved, but its values are not used. This costs some extra time |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
56 when scanning an mbox when opening it.") |
17493 | 57 |
58 (defvoo nnfolder-distrust-mbox nil | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
59 "If non-nil, the folder will be distrusted. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
60 This means that nnfolder will not trust the user with respect to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
61 inserting unaccounted for mail in the middle of an mbox file. This |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
62 can greatly slow down scans, which now must scan the entire file for |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
63 unmarked messages. When nil, scans occur forward from the last marked |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
64 message, a huge time saver for large mailboxes.") |
17493 | 65 |
66 (defvoo nnfolder-newsgroups-file | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
67 (concat (file-name-as-directory nnfolder-directory) "newsgroups") |
17493 | 68 "Mail newsgroups description file.") |
69 | |
70 (defvoo nnfolder-get-new-mail t | |
71 "If non-nil, nnfolder will check the incoming mail file and split the mail.") | |
72 | |
73 (defvoo nnfolder-prepare-save-mail-hook nil | |
74 "Hook run narrowed to an article before saving.") | |
75 | |
76 (defvoo nnfolder-save-buffer-hook nil | |
77 "Hook run before saving the nnfolder mbox buffer.") | |
78 | |
79 (defvoo nnfolder-inhibit-expiry nil | |
80 "If non-nil, inhibit expiry.") | |
81 | |
82 | |
83 | |
84 (defconst nnfolder-version "nnfolder 1.0" | |
85 "nnfolder version.") | |
86 | |
87 (defconst nnfolder-article-marker "X-Gnus-Article-Number: " | |
88 "String used to demarcate what the article number for a message is.") | |
89 | |
90 (defvoo nnfolder-current-group nil) | |
91 (defvoo nnfolder-current-buffer nil) | |
92 (defvoo nnfolder-status-string "") | |
93 (defvoo nnfolder-group-alist nil) | |
94 (defvoo nnfolder-buffer-alist nil) | |
95 (defvoo nnfolder-scantime-alist nil) | |
96 (defvoo nnfolder-active-timestamp nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
97 (defvoo nnfolder-active-file-coding-system mm-text-coding-system) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
98 (defvoo nnfolder-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
|
99 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
|
100 (defvoo nnfolder-file-coding-system mm-text-coding-system) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
101 (defvoo nnfolder-file-coding-system-for-write nnheader-file-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
102 "Coding system for save nnfolder file. |
42206 | 103 If nil, `nnfolder-file-coding-system' is used.") |
17493 | 104 |
105 | |
106 | |
107 ;;; Interface functions | |
108 | |
109 (nnoo-define-basics nnfolder) | |
110 | |
111 (deffoo nnfolder-retrieve-headers (articles &optional group server fetch-old) | |
112 (save-excursion | |
113 (set-buffer nntp-server-buffer) | |
114 (erase-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
115 (let (article start stop) |
17493 | 116 (nnfolder-possibly-change-group group server) |
117 (when nnfolder-current-buffer | |
118 (set-buffer nnfolder-current-buffer) | |
119 (goto-char (point-min)) | |
120 (if (stringp (car articles)) | |
121 'headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
122 (while (setq article (pop articles)) |
17493 | 123 (set-buffer nnfolder-current-buffer) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
124 (when (nnfolder-goto-article article) |
17493 | 125 (setq start (point)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
126 (setq stop (if (search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
127 (1- (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
128 (point-max))) |
17493 | 129 (set-buffer nntp-server-buffer) |
130 (insert (format "221 %d Article retrieved.\n" article)) | |
131 (insert-buffer-substring nnfolder-current-buffer start stop) | |
132 (goto-char (point-max)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
133 (insert ".\n"))) |
17493 | 134 |
135 (set-buffer nntp-server-buffer) | |
136 (nnheader-fold-continuation-lines) | |
137 'headers))))) | |
138 | |
139 (deffoo nnfolder-open-server (server &optional defs) | |
140 (nnoo-change-server 'nnfolder server defs) | |
141 (nnmail-activate 'nnfolder t) | |
142 (gnus-make-directory nnfolder-directory) | |
143 (cond | |
144 ((not (file-exists-p nnfolder-directory)) | |
145 (nnfolder-close-server) | |
146 (nnheader-report 'nnfolder "Couldn't create directory: %s" | |
147 nnfolder-directory)) | |
148 ((not (file-directory-p (file-truename nnfolder-directory))) | |
149 (nnfolder-close-server) | |
150 (nnheader-report 'nnfolder "Not a directory: %s" nnfolder-directory)) | |
151 (t | |
152 (nnmail-activate 'nnfolder) | |
153 (nnheader-report 'nnfolder "Opened server %s using directory %s" | |
154 server nnfolder-directory) | |
155 t))) | |
156 | |
157 (deffoo nnfolder-request-close () | |
158 (let ((alist nnfolder-buffer-alist)) | |
159 (while alist | |
160 (nnfolder-close-group (caar alist) nil t) | |
161 (setq alist (cdr alist)))) | |
162 (nnoo-close-server 'nnfolder) | |
163 (setq nnfolder-buffer-alist nil | |
164 nnfolder-group-alist nil)) | |
165 | |
166 (deffoo nnfolder-request-article (article &optional group server buffer) | |
167 (nnfolder-possibly-change-group group server) | |
168 (save-excursion | |
169 (set-buffer nnfolder-current-buffer) | |
170 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
171 (when (nnfolder-goto-article article) |
17493 | 172 (let (start stop) |
173 (setq start (point)) | |
174 (forward-line 1) | |
175 (unless (and (nnmail-search-unix-mail-delim) | |
176 (forward-line -1)) | |
177 (goto-char (point-max))) | |
178 (setq stop (point)) | |
179 (let ((nntp-server-buffer (or buffer nntp-server-buffer))) | |
180 (set-buffer nntp-server-buffer) | |
181 (erase-buffer) | |
182 (insert-buffer-substring nnfolder-current-buffer start stop) | |
183 (goto-char (point-min)) | |
184 (while (looking-at "From ") | |
185 (delete-char 5) | |
186 (insert "X-From-Line: ") | |
187 (forward-line 1)) | |
188 (if (numberp article) | |
189 (cons nnfolder-current-group article) | |
190 (goto-char (point-min)) | |
191 (cons nnfolder-current-group | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
192 (if (search-forward (concat "\n" nnfolder-article-marker) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
193 nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
194 (string-to-int |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
195 (buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
196 (point) (progn (end-of-line) (point)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
197 -1)))))))) |
17493 | 198 |
199 (deffoo nnfolder-request-group (group &optional server dont-check) | |
200 (nnfolder-possibly-change-group group server t) | |
201 (save-excursion | |
202 (if (not (assoc group nnfolder-group-alist)) | |
203 (nnheader-report 'nnfolder "No such group: %s" group) | |
204 (if dont-check | |
205 (progn | |
206 (nnheader-report 'nnfolder "Selected group %s" group) | |
207 t) | |
208 (let* ((active (assoc group nnfolder-group-alist)) | |
209 (group (car active)) | |
210 (range (cadr active))) | |
211 (cond | |
212 ((null active) | |
213 (nnheader-report 'nnfolder "No such group: %s" group)) | |
214 ((null nnfolder-current-group) | |
215 (nnheader-report 'nnfolder "Empty group: %s" group)) | |
216 (t | |
217 (nnheader-report 'nnfolder "Selected group %s" group) | |
218 (nnheader-insert "211 %d %d %d %s\n" | |
219 (1+ (- (cdr range) (car range))) | |
220 (car range) (cdr range) group)))))))) | |
221 | |
222 (deffoo nnfolder-request-scan (&optional group server) | |
223 (nnfolder-possibly-change-group nil server) | |
224 (when nnfolder-get-new-mail | |
225 (nnfolder-possibly-change-group group server) | |
226 (nnmail-get-new-mail | |
227 'nnfolder | |
228 (lambda () | |
229 (let ((bufs nnfolder-buffer-alist)) | |
230 (save-excursion | |
231 (while bufs | |
232 (if (not (gnus-buffer-live-p (nth 1 (car bufs)))) | |
233 (setq nnfolder-buffer-alist | |
234 (delq (car bufs) nnfolder-buffer-alist)) | |
235 (set-buffer (nth 1 (car bufs))) | |
236 (nnfolder-save-buffer) | |
237 (kill-buffer (current-buffer))) | |
238 (setq bufs (cdr bufs)))))) | |
239 nnfolder-directory | |
240 group))) | |
241 | |
242 ;; Don't close the buffer if we're not shutting down the server. This way, | |
243 ;; we can keep the buffer in the group buffer cache, and not have to grovel | |
244 ;; over the buffer again unless we add new mail to it or modify it in some | |
245 ;; way. | |
246 | |
247 (deffoo nnfolder-close-group (group &optional server force) | |
248 ;; Make sure we _had_ the group open. | |
249 (when (or (assoc group nnfolder-buffer-alist) | |
250 (equal group nnfolder-current-group)) | |
251 (let ((inf (assoc group nnfolder-buffer-alist))) | |
252 (when inf | |
253 (when (and nnfolder-current-group | |
254 nnfolder-current-buffer) | |
255 (push (list nnfolder-current-group nnfolder-current-buffer) | |
256 nnfolder-buffer-alist)) | |
257 (setq nnfolder-buffer-alist | |
258 (delq inf nnfolder-buffer-alist)) | |
259 (setq nnfolder-current-buffer (cadr inf) | |
260 nnfolder-current-group (car inf)))) | |
261 (when (and nnfolder-current-buffer | |
262 (buffer-name nnfolder-current-buffer)) | |
263 (save-excursion | |
264 (set-buffer nnfolder-current-buffer) | |
265 ;; If the buffer was modified, write the file out now. | |
266 (nnfolder-save-buffer) | |
267 ;; If we're shutting the server down, we need to kill the | |
268 ;; buffer and remove it from the open buffer list. Or, of | |
269 ;; course, if we're trying to minimize our space impact. | |
270 (kill-buffer (current-buffer)) | |
271 (setq nnfolder-buffer-alist (delq (assoc group nnfolder-buffer-alist) | |
272 nnfolder-buffer-alist))))) | |
273 (setq nnfolder-current-group nil | |
274 nnfolder-current-buffer nil) | |
275 t) | |
276 | |
277 (deffoo nnfolder-request-create-group (group &optional server args) | |
278 (nnfolder-possibly-change-group nil server) | |
279 (nnmail-activate 'nnfolder) | |
280 (when group | |
281 (unless (assoc group nnfolder-group-alist) | |
282 (push (list group (cons 1 0)) nnfolder-group-alist) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
283 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
284 (nnfolder-read-folder group))) |
17493 | 285 t) |
286 | |
287 (deffoo nnfolder-request-list (&optional server) | |
288 (nnfolder-possibly-change-group nil server) | |
289 (save-excursion | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
290 (let ((nnmail-file-coding-system nnfolder-active-file-coding-system)) |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
291 (nnmail-find-file nnfolder-active-file) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
292 (setq nnfolder-group-alist (nnmail-get-active))) |
17493 | 293 t)) |
294 | |
295 (deffoo nnfolder-request-newgroups (date &optional server) | |
296 (nnfolder-possibly-change-group nil server) | |
297 (nnfolder-request-list server)) | |
298 | |
299 (deffoo nnfolder-request-list-newsgroups (&optional server) | |
300 (nnfolder-possibly-change-group nil server) | |
301 (save-excursion | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
302 (let ((nnmail-file-coding-system nnfolder-file-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
303 (nnmail-find-file nnfolder-newsgroups-file)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
304 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
305 ;; Return a list consisting of all article numbers existing in the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
306 ;; current folder. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
308 (defun nnfolder-existing-articles () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
309 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
310 (when nnfolder-current-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
311 (set-buffer nnfolder-current-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
312 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
313 (let ((marker (concat "\n" nnfolder-article-marker)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
314 (number "[0-9]+") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
315 numbers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
316 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
317 (while (and (search-forward marker nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
318 (re-search-forward number nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
319 (let ((newnum (string-to-number (match-string 0)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
320 (if (nnmail-within-headers-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
321 (push newnum numbers)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
322 numbers)))) |
17493 | 323 |
324 (deffoo nnfolder-request-expire-articles | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
325 (articles newsgroup &optional server force) |
17493 | 326 (nnfolder-possibly-change-group newsgroup server) |
327 (let* ((is-old t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
328 ;; The articles we have deleted so far. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
329 (deleted-articles nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
330 ;; The articles that really exist and will |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
331 ;; be expired if they are old enough. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
332 (maybe-expirable |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
333 (gnus-intersection articles (nnfolder-existing-articles)))) |
17493 | 334 (nnmail-activate 'nnfolder) |
335 | |
336 (save-excursion | |
337 (set-buffer nnfolder-current-buffer) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
338 ;; Since messages are sorted in arrival order and expired in the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
339 ;; same order, we can stop as soon as we find a message that is |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
340 ;; too old. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
341 (while (and maybe-expirable is-old) |
17493 | 342 (goto-char (point-min)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
343 (when (and (nnfolder-goto-article (car maybe-expirable)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
344 (search-forward (concat "\n" nnfolder-article-marker) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
345 nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
346 (forward-sexp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
347 (when (setq is-old |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
348 (nnmail-expired-article-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
349 newsgroup |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
350 (buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
351 (point) (progn (end-of-line) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
352 force nnfolder-inhibit-expiry)) |
47002
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
353 (unless (eq nnmail-expiry-target 'delete) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
354 (with-temp-buffer |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
355 (nnfolder-request-article (car maybe-expirable) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
356 newsgroup server (current-buffer)) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
357 (let ((nnml-current-directory nil)) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
358 (nnmail-expiry-target-group |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
359 nnmail-expiry-target newsgroup)))) |
b87254142b98
* nnfolder.el (nnfolder-request-expire-articles): expiry-target.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
44513
diff
changeset
|
360 (nnheader-message 5 "Deleting article %d in %s..." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
361 (car maybe-expirable) newsgroup) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
362 (nnfolder-delete-mail) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
363 ;; Must remember which articles were actually deleted |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
364 (push (car maybe-expirable) deleted-articles))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
365 (setq maybe-expirable (cdr maybe-expirable))) |
17493 | 366 (unless nnfolder-inhibit-expiry |
367 (nnheader-message 5 "Deleting articles...done")) | |
368 (nnfolder-save-buffer) | |
369 (nnfolder-adjust-min-active newsgroup) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
370 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
371 (gnus-sorted-complement articles (nreverse deleted-articles))))) |
17493 | 372 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
373 (deffoo nnfolder-request-move-article (article group server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
374 accept-form &optional last) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
375 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
376 (let ((buf (get-buffer-create " *nnfolder move*")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
377 result) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
378 (and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
379 (nnfolder-request-article article group server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
380 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
381 (set-buffer buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
382 (erase-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
383 (insert-buffer-substring nntp-server-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
384 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
385 (while (re-search-forward |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
386 (concat "^" nnfolder-article-marker) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
387 (save-excursion (and (search-forward "\n\n" nil t) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
388 t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
389 (delete-region (progn (beginning-of-line) (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
390 (progn (forward-line 1) (point)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
391 (setq result (eval accept-form)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
392 (kill-buffer buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
393 result) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
394 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
395 (nnfolder-possibly-change-group group server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
396 (set-buffer nnfolder-current-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
397 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
398 (when (nnfolder-goto-article article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
399 (nnfolder-delete-mail)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
400 (when last |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
401 (nnfolder-save-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
402 (nnfolder-adjust-min-active group) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
403 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
404 result))) |
17493 | 405 |
406 (deffoo nnfolder-request-accept-article (group &optional server last) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
407 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
408 (nnfolder-possibly-change-group group server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
409 (nnmail-check-syntax) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
410 (let ((buf (current-buffer)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
411 result art-group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
412 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
413 (when (looking-at "X-From-Line: ") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
414 (replace-match "From ")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
415 (and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
416 (nnfolder-request-list) |
17493 | 417 (save-excursion |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
418 (set-buffer buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
419 (goto-char (point-min)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
420 (if (search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
421 (forward-line -1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
422 (goto-char (point-max))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
423 (while (re-search-backward (concat "^" nnfolder-article-marker) nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
424 (delete-region (point) (progn (forward-line 1) (point)))) |
17493 | 425 (when nnmail-cache-accepted-message-ids |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
426 (nnmail-cache-insert (nnmail-fetch-field "message-id"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
427 (setq result (if (stringp group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
428 (list (cons group (nnfolder-active-number group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
429 (setq art-group |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
430 (nnmail-article-group 'nnfolder-active-number)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
431 (if (and (null result) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
432 (yes-or-no-p "Moved to `junk' group; delete article? ")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
433 (setq result 'junk) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
434 (setq result |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
435 (car (nnfolder-save-mail result))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
436 (when last |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
437 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
438 (nnfolder-possibly-change-folder (or (caar art-group) group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
439 (nnfolder-save-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
440 (when nnmail-cache-accepted-message-ids |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
441 (nnmail-cache-close))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
442 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
443 (unless result |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
444 (nnheader-report 'nnfolder "Couldn't store article")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
445 result))) |
17493 | 446 |
447 (deffoo nnfolder-request-replace-article (article group buffer) | |
448 (nnfolder-possibly-change-group group) | |
449 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
450 (set-buffer buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
451 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
452 (let (xfrom) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
453 (while (re-search-forward "^X-From-Line: \\(.*\\)$" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
454 (setq xfrom (match-string 1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
455 (gnus-delete-line)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
456 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
457 (if xfrom |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
458 (insert "From " xfrom "\n") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
459 (unless (looking-at "From ") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
460 (insert "From nobody " (current-time-string) "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
461 (nnfolder-normalize-buffer) |
17493 | 462 (set-buffer nnfolder-current-buffer) |
463 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
464 (if (not (nnfolder-goto-article article)) |
17493 | 465 nil |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
466 (nnfolder-delete-mail) |
17493 | 467 (insert-buffer-substring buffer) |
468 (nnfolder-save-buffer) | |
469 t))) | |
470 | |
471 (deffoo nnfolder-request-delete-group (group &optional force server) | |
472 (nnfolder-close-group group server t) | |
473 ;; Delete all articles in GROUP. | |
474 (if (not force) | |
475 () ; Don't delete the articles. | |
476 ;; Delete the file that holds the group. | |
477 (ignore-errors | |
478 (delete-file (nnfolder-group-pathname group)))) | |
479 ;; Remove the group from all structures. | |
480 (setq nnfolder-group-alist | |
481 (delq (assoc group nnfolder-group-alist) nnfolder-group-alist) | |
482 nnfolder-current-group nil | |
483 nnfolder-current-buffer nil) | |
484 ;; 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
|
485 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
17493 | 486 t) |
487 | |
488 (deffoo nnfolder-request-rename-group (group new-name &optional server) | |
489 (nnfolder-possibly-change-group group server) | |
490 (save-excursion | |
491 (set-buffer nnfolder-current-buffer) | |
492 (and (file-writable-p buffer-file-name) | |
493 (ignore-errors | |
494 (rename-file | |
495 buffer-file-name | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
496 (let ((new-file (nnfolder-group-pathname new-name))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
497 (gnus-make-directory (file-name-directory new-file)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
498 new-file)) |
17493 | 499 t) |
500 ;; That went ok, so we change the internal structures. | |
501 (let ((entry (assoc group nnfolder-group-alist))) | |
502 (and entry (setcar entry new-name)) | |
503 (setq nnfolder-current-buffer nil | |
504 nnfolder-current-group nil) | |
505 ;; 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
|
506 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
17493 | 507 ;; We kill the buffer instead of renaming it and stuff. |
508 (kill-buffer (current-buffer)) | |
509 t)))) | |
510 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
511 (defun nnfolder-request-regenerate (server) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
512 (nnfolder-possibly-change-group nil server) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
513 (nnfolder-generate-active-file) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
514 t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
515 |
17493 | 516 |
517 ;;; Internal functions. | |
518 | |
519 (defun nnfolder-adjust-min-active (group) | |
520 ;; Find the lowest active article in this group. | |
521 (let* ((active (cadr (assoc group nnfolder-group-alist))) | |
522 (marker (concat "\n" nnfolder-article-marker)) | |
523 (number "[0-9]+") | |
524 (activemin (cdr active))) | |
525 (save-excursion | |
526 (set-buffer nnfolder-current-buffer) | |
527 (goto-char (point-min)) | |
528 (while (and (search-forward marker nil t) | |
529 (re-search-forward number nil t)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
530 (let ((newnum (string-to-number (match-string 0)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
531 (if (nnmail-within-headers-p) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
532 (setq activemin (min activemin newnum))))) |
17493 | 533 (setcar active activemin)))) |
534 | |
535 (defun nnfolder-article-string (article) | |
536 (if (numberp article) | |
537 (concat "\n" nnfolder-article-marker (int-to-string article) " ") | |
538 (concat "\nMessage-ID: " article))) | |
539 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
540 (defun nnfolder-goto-article (article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
541 "Place point at the start of the headers of ARTICLE. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
542 ARTICLE can be an article number or a Message-ID. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
543 Returns t if successful, nil otherwise." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
544 (let ((art-string (nnfolder-article-string article)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
545 start found) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
546 ;; It is likely that we are at or before the delimiter line. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
547 ;; We therefore go to the end of the previous line, and start |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
548 ;; searching from there. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
549 (beginning-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
550 (unless (bobp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
551 (forward-char -1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
552 (setq start (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
553 ;; First search forward. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
554 (while (and (setq found (search-forward art-string nil t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
555 (not (nnmail-within-headers-p)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
556 ;; If unsuccessful, search backward from where we started, |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
557 (unless found |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
558 (goto-char start) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
559 (while (and (setq found (search-backward art-string nil t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
560 (not (nnmail-within-headers-p))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
561 (when found |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
562 (nnmail-search-unix-mail-delim-backward)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
563 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
564 (defun nnfolder-delete-mail (&optional leave-delim) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
565 "Delete the message that point is in. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
566 If optional argument LEAVE-DELIM is t, then mailbox delimiter is not |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
567 deleted. Point is left where the deleted region was." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
568 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
569 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
570 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
571 ;; In case point is at the beginning of the message already. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
572 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
573 (nnmail-search-unix-mail-delim-backward) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
574 (if leave-delim (progn (forward-line 1) (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
575 (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
576 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
577 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
578 (if (nnmail-search-unix-mail-delim) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
579 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
580 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
581 (run-hooks 'nnfolder-delete-mail-hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
582 (delete-region (point-min) (point-max)))) |
17493 | 583 |
584 (defun nnfolder-possibly-change-group (group &optional server dont-check) | |
585 ;; Change servers. | |
586 (when (and server | |
587 (not (nnfolder-server-opened server))) | |
588 (nnfolder-open-server server)) | |
589 (unless (gnus-buffer-live-p nnfolder-current-buffer) | |
590 (setq nnfolder-current-buffer nil | |
591 nnfolder-current-group nil)) | |
592 ;; Change group. | |
593 (when (and group | |
594 (not (equal group nnfolder-current-group))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
595 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
596 (nnmail-activate 'nnfolder) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
597 (when (and (not (assoc group nnfolder-group-alist)) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
598 (not (file-exists-p |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
599 (nnfolder-group-pathname group)))) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
600 ;; The group doesn't exist, so we create a new entry for it. |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
601 (push (list group (cons 1 0)) nnfolder-group-alist) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
602 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
603 |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
604 (if dont-check |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
605 (setq nnfolder-current-group group |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
606 nnfolder-current-buffer nil) |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
607 (let (inf file) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
608 ;; If we have to change groups, see if we don't already have the |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
609 ;; folder in memory. If we do, verify the modtime and destroy |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
610 ;; the folder if needed so we can rescan it. |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
611 (setq nnfolder-current-buffer |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
612 (nth 1 (assoc group nnfolder-buffer-alist))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
613 |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
614 ;; If the buffer is not live, make sure it isn't in the alist. If it |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
615 ;; is live, verify that nobody else has touched the file since last |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
616 ;; time. |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
617 (when (and nnfolder-current-buffer |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
618 (not (gnus-buffer-live-p nnfolder-current-buffer))) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
619 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
620 nnfolder-current-buffer nil)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
621 |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
622 (setq nnfolder-current-group group) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
623 |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
624 (when (or (not nnfolder-current-buffer) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
625 (not (verify-visited-file-modtime |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
626 nnfolder-current-buffer))) |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
627 (save-excursion |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
628 (setq file (nnfolder-group-pathname group)) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
629 ;; See whether we need to create the new file. |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
630 (unless (file-exists-p file) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
631 (gnus-make-directory (file-name-directory file)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
632 (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
|
633 (or nnfolder-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
|
634 nnfolder-file-coding-system-for-write))) |
44513
ce14b691fc8b
(nnfolder-possibly-change-group): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42206
diff
changeset
|
635 (nnmail-write-region (point-min) (point-min) |
ce14b691fc8b
(nnfolder-possibly-change-group): Don't assume point-min == 1.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42206
diff
changeset
|
636 file t 'nomesg))) |
19597
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
637 (when (setq nnfolder-current-buffer (nnfolder-read-folder group)) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
638 (set-buffer nnfolder-current-buffer) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
639 (push (list group nnfolder-current-buffer) |
1dfca0cdcb91
(nnfolder-request-list): Override
Kenichi Handa <handa@m17n.org>
parents:
19495
diff
changeset
|
640 nnfolder-buffer-alist))))))))) |
17493 | 641 |
642 (defun nnfolder-save-mail (group-art-list) | |
643 "Called narrowed to an article." | |
644 (let* (save-list group-art) | |
645 (goto-char (point-min)) | |
646 ;; The From line may have been quoted by movemail. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
647 (when (looking-at ">From") |
17493 | 648 (delete-char 1)) |
649 ;; This might come from somewhere else. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
650 (unless (looking-at "From ") |
17493 | 651 (insert "From nobody " (current-time-string) "\n") |
652 (goto-char (point-min))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
653 ;; Quote all "From " lines in the article. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
654 (forward-line 1) |
17493 | 655 (let (case-fold-search) |
656 (while (re-search-forward "^From " nil t) | |
657 (beginning-of-line) | |
658 (insert "> "))) | |
659 (setq save-list group-art-list) | |
660 (nnmail-insert-lines) | |
661 (nnmail-insert-xref group-art-list) | |
662 (run-hooks 'nnmail-prepare-save-mail-hook) | |
663 (run-hooks 'nnfolder-prepare-save-mail-hook) | |
664 | |
665 ;; Insert the mail into each of the destination groups. | |
666 (while (setq group-art (pop group-art-list)) | |
667 ;; Kill any previous newsgroup markers. | |
668 (goto-char (point-min)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
669 (if (search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
670 (forward-line -1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
671 (goto-char (point-max))) |
17493 | 672 (while (search-backward (concat "\n" nnfolder-article-marker) nil t) |
673 (delete-region (1+ (point)) (progn (forward-line 2) (point)))) | |
674 | |
675 ;; Insert the new newsgroup marker. | |
676 (nnfolder-insert-newsgroup-line group-art) | |
677 | |
678 (save-excursion | |
679 (let ((beg (point-min)) | |
680 (end (point-max)) | |
681 (obuf (current-buffer))) | |
682 (nnfolder-possibly-change-folder (car group-art)) | |
683 (let ((buffer-read-only nil)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
684 (nnfolder-normalize-buffer) |
17493 | 685 (insert-buffer-substring obuf beg end))))) |
686 | |
687 ;; Did we save it anywhere? | |
688 save-list)) | |
689 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
690 (defun nnfolder-normalize-buffer () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
691 "Make sure there are two newlines at the end of the buffer." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
692 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
693 (skip-chars-backward "\n") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
694 (delete-region (point) (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
695 (insert "\n\n")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
696 |
17493 | 697 (defun nnfolder-insert-newsgroup-line (group-art) |
698 (save-excursion | |
699 (goto-char (point-min)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
700 (unless (search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
701 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
702 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
703 (forward-char -1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
704 (insert (format (concat nnfolder-article-marker "%d %s\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
705 (cdr group-art) (current-time-string))))) |
17493 | 706 |
707 (defun nnfolder-active-number (group) | |
708 ;; Find the next article number in GROUP. | |
709 (let ((active (cadr (assoc group nnfolder-group-alist)))) | |
710 (if active | |
711 (setcdr active (1+ (cdr active))) | |
712 ;; This group is new, so we create a new entry for it. | |
713 ;; This might be a bit naughty... creating groups on the drop of | |
714 ;; a hat, but I don't know... | |
715 (push (list group (setq active (cons 1 1))) | |
716 nnfolder-group-alist)) | |
717 (cdr active))) | |
718 | |
719 (defun nnfolder-possibly-change-folder (group) | |
720 (let ((inf (assoc group nnfolder-buffer-alist))) | |
721 (if (and inf | |
722 (gnus-buffer-live-p (cadr inf))) | |
723 (set-buffer (cadr inf)) | |
724 (when inf | |
725 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist))) | |
726 (when nnfolder-group-alist | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
727 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file)) |
17493 | 728 (push (list group (nnfolder-read-folder group)) |
729 nnfolder-buffer-alist)))) | |
730 | |
731 ;; This method has a problem if you've accidentally let the active list get | |
732 ;; out of sync with the files. This could happen, say, if you've | |
733 ;; accidentally gotten new mail with something other than Gnus (but why | |
734 ;; would _that_ ever happen? :-). In that case, we will be in the middle of | |
735 ;; processing the file, ready to add new X-Gnus article number markers, and | |
736 ;; we'll run across a message with no ID yet - the active list _may_not_ be | |
737 ;; ready for us yet. | |
738 | |
739 ;; To handle this, I'm modifying this routine to maintain the maximum ID seen | |
740 ;; so far, and when we hit a message with no ID, we will _manually_ scan the | |
741 ;; rest of the message looking for any more, possibly higher IDs. We'll | |
742 ;; assume the maximum that we find is the highest active. Note that this | |
743 ;; shouldn't cost us much extra time at all, but will be a lot less | |
744 ;; vulnerable to glitches between the mbox and the active file. | |
745 | |
746 (defun nnfolder-read-folder (group) | |
747 (let* ((file (nnfolder-group-pathname group)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
748 (buffer (set-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
749 (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
|
750 nnfolder-file-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
751 (nnheader-find-file-noselect file))))) |
38382
36083635b0c6
(nnfolder-read-folder): Force to use a multibyte buffer.
Gerd Moellmann <gerd@gnu.org>
parents:
32193
diff
changeset
|
752 (mm-enable-multibyte) ;; Use multibyte buffer for future copying. |
17493 | 753 (if (equal (cadr (assoc group nnfolder-scantime-alist)) |
754 (nth 5 (file-attributes file))) | |
755 ;; This looks up-to-date, so we don't do any scanning. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
756 (if (file-exists-p file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
757 buffer |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
758 (push (list group buffer) nnfolder-buffer-alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
759 (set-buffer-modified-p t) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
760 (nnfolder-save-buffer)) |
17493 | 761 ;; Parse the damn thing. |
762 (save-excursion | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
763 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
764 ;; Remove any blank lines at the start. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
765 (while (eq (following-char) ?\n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
766 (delete-char 1)) |
17493 | 767 (nnmail-activate 'nnfolder) |
768 ;; Read in the file. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
769 (let ((delim "^From ") |
17493 | 770 (marker (concat "\n" nnfolder-article-marker)) |
771 (number "[0-9]+") | |
772 (active (or (cadr (assoc group nnfolder-group-alist)) | |
773 (cons 1 0))) | |
774 (scantime (assoc group nnfolder-scantime-alist)) | |
775 (minid (lsh -1 -1)) | |
776 maxid start end newscantime | |
777 buffer-read-only) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
778 (buffer-disable-undo) |
17493 | 779 (setq maxid (cdr active)) |
780 (goto-char (point-min)) | |
781 | |
782 ;; Anytime the active number is 1 or 0, it is suspect. In that | |
783 ;; case, search the file manually to find the active number. Or, | |
784 ;; of course, if we're being paranoid. (This would also be the | |
785 ;; place to build other lists from the header markers, such as | |
786 ;; expunge lists, etc., if we ever desired to abandon the active | |
787 ;; file entirely for mboxes.) | |
788 (when (or nnfolder-ignore-active-file | |
789 (< maxid 2)) | |
790 (while (and (search-forward marker nil t) | |
791 (re-search-forward number nil t)) | |
792 (let ((newnum (string-to-number (match-string 0)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
793 (if (nnmail-within-headers-p) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
794 (setq maxid (max maxid newnum) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
795 minid (min minid newnum))))) |
17493 | 796 (setcar active (max 1 (min minid maxid))) |
797 (setcdr active (max maxid (cdr active))) | |
798 (goto-char (point-min))) | |
799 | |
800 ;; As long as we trust that the user will only insert unmarked mail | |
801 ;; at the end, go to the end and search backwards for the last | |
802 ;; marker. Find the start of that message, and begin to search for | |
803 ;; unmarked messages from there. | |
804 (when (not (or nnfolder-distrust-mbox | |
805 (< maxid 2))) | |
806 (goto-char (point-max)) | |
807 (unless (re-search-backward marker nil t) | |
808 (goto-char (point-min))) | |
809 (when (nnmail-search-unix-mail-delim) | |
810 (goto-char (point-min)))) | |
811 | |
812 ;; Keep track of the active number on our own, and insert it back | |
813 ;; into the active list when we're done. Also, prime the pump to | |
814 ;; cut down on the number of searches we do. | |
815 (unless (nnmail-search-unix-mail-delim) | |
816 (goto-char (point-max))) | |
817 (setq end (point-marker)) | |
818 (while (not (= end (point-max))) | |
819 (setq start (marker-position end)) | |
820 (goto-char end) | |
821 ;; There may be more than one "From " line, so we skip past | |
822 ;; them. | |
823 (while (looking-at delim) | |
824 (forward-line 1)) | |
825 (set-marker end (if (nnmail-search-unix-mail-delim) | |
826 (point) | |
827 (point-max))) | |
828 (goto-char start) | |
829 (when (not (search-forward marker end t)) | |
830 (narrow-to-region start end) | |
831 (nnmail-insert-lines) | |
832 (nnfolder-insert-newsgroup-line | |
833 (cons nil (nnfolder-active-number nnfolder-current-group))) | |
834 (widen))) | |
835 | |
836 (set-marker end nil) | |
837 ;; Make absolutely sure that the active list reflects reality! | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
838 (nnfolder-save-active nnfolder-group-alist nnfolder-active-file) |
17493 | 839 ;; Set the scantime for this group. |
840 (setq newscantime (visited-file-modtime)) | |
841 (if scantime | |
842 (setcdr scantime (list newscantime)) | |
843 (push (list nnfolder-current-group newscantime) | |
844 nnfolder-scantime-alist)) | |
845 (current-buffer)))))) | |
846 | |
847 ;;;###autoload | |
848 (defun nnfolder-generate-active-file () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
849 "Look for mbox folders in the nnfolder directory and make them into groups. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
850 This command does not work if you use short group names." |
17493 | 851 (interactive) |
852 (nnmail-activate 'nnfolder) | |
853 (let ((files (directory-files nnfolder-directory)) | |
854 file) | |
855 (while (setq file (pop files)) | |
856 (when (and (not (backup-file-name-p file)) | |
857 (message-mail-file-mbox-p | |
858 (nnheader-concat nnfolder-directory file))) | |
859 (let ((oldgroup (assoc file nnfolder-group-alist))) | |
860 (if oldgroup | |
861 (nnheader-message 5 "Refreshing group %s..." file) | |
862 (nnheader-message 5 "Adding group %s..." file)) | |
19495
50eec8e7a005
(nnfolder-generate-active-file): Don't use remove.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
863 (if oldgroup |
50eec8e7a005
(nnfolder-generate-active-file): Don't use remove.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
864 (setq nnfolder-group-alist |
50eec8e7a005
(nnfolder-generate-active-file): Don't use remove.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
865 (delq oldgroup (copy-sequence nnfolder-group-alist)))) |
17493 | 866 (push (list file (cons 1 0)) nnfolder-group-alist) |
867 (nnfolder-possibly-change-folder file) | |
868 (nnfolder-possibly-change-group file) | |
869 (nnfolder-close-group file)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19990
diff
changeset
|
870 (nnheader-message 5 ""))) |
17493 | 871 |
872 (defun nnfolder-group-pathname (group) | |
873 "Make pathname for GROUP." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
874 (setq group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
875 (mm-encode-coding-string group nnmail-pathname-coding-system)) |
17493 | 876 (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory)))) |
877 ;; If this file exists, we use it directly. | |
878 (if (or nnmail-use-long-file-names | |
879 (file-exists-p (concat dir group))) | |
880 (concat dir group) | |
881 ;; If not, we translate dots into slashes. | |
882 (concat dir (nnheader-replace-chars-in-string group ?. ?/))))) | |
883 | |
884 (defun nnfolder-save-buffer () | |
885 "Save the buffer." | |
886 (when (buffer-modified-p) | |
887 (run-hooks 'nnfolder-save-buffer-hook) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19597
diff
changeset
|
888 (gnus-make-directory (file-name-directory (buffer-file-name))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
889 (let ((coding-system-for-write |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
890 (or nnfolder-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
|
891 nnfolder-file-coding-system))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
892 (save-buffer)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
893 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
894 (defun nnfolder-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
|
895 (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
|
896 (or nnfolder-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
|
897 nnfolder-active-file-coding-system))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
898 (nnmail-save-active group-alist active-file))) |
17493 | 899 |
900 (provide 'nnfolder) | |
901 | |
902 ;;; nnfolder.el ends here |