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

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents cf808b4c4290
children 48d667d6f17f
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>. 27 ;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>.
28 ;; For an overview of what the interface functions do, please see the 28 ;; For an overview of what the interface functions do, please see the
29 ;; Gnus sources. 29 ;; Gnus sources.
30 30
31 ;;; Code: 31 ;;; Code:
32 32
33 (require 'nnheader) 33 (require 'nnheader)
34 (require 'nnmail) 34 (require 'nnmail)
38 (nnoo-declare nnml) 38 (nnoo-declare nnml)
39 39
40 (defvoo nnml-directory message-directory 40 (defvoo nnml-directory message-directory
41 "Mail spool directory.") 41 "Mail spool directory.")
42 42
43 (defvoo nnml-active-file 43 (defvoo nnml-active-file
44 (concat (file-name-as-directory nnml-directory) "active") 44 (concat (file-name-as-directory nnml-directory) "active")
45 "Mail active file.") 45 "Mail active file.")
46 46
47 (defvoo nnml-newsgroups-file 47 (defvoo nnml-newsgroups-file
48 (concat (file-name-as-directory nnml-directory) "newsgroups") 48 (concat (file-name-as-directory nnml-directory) "newsgroups")
49 "Mail newsgroups description file.") 49 "Mail newsgroups description file.")
50 50
51 (defvoo nnml-get-new-mail t 51 (defvoo nnml-get-new-mail t
52 "If non-nil, nnml will check the incoming mail file and split the mail.") 52 "If non-nil, nnml will check the incoming mail file and split the mail.")
138 (nnoo-change-server 'nnml server defs) 138 (nnoo-change-server 'nnml server defs)
139 (when (not (file-exists-p nnml-directory)) 139 (when (not (file-exists-p nnml-directory))
140 (condition-case () 140 (condition-case ()
141 (make-directory nnml-directory t) 141 (make-directory nnml-directory t)
142 (error))) 142 (error)))
143 (cond 143 (cond
144 ((not (file-exists-p nnml-directory)) 144 ((not (file-exists-p nnml-directory))
145 (nnml-close-server) 145 (nnml-close-server)
146 (nnheader-report 'nnml "Couldn't create directory: %s" nnml-directory)) 146 (nnheader-report 'nnml "Couldn't create directory: %s" nnml-directory))
147 ((not (file-directory-p (file-truename nnml-directory))) 147 ((not (file-directory-p (file-truename nnml-directory)))
148 (nnml-close-server) 148 (nnml-close-server)
170 (nnmail-group-pathname 170 (nnmail-group-pathname
171 (car group-num) 171 (car group-num)
172 nnml-directory)))))) 172 nnml-directory))))))
173 (setq path (concat gpath (int-to-string (cdr group-num))))) 173 (setq path (concat gpath (int-to-string (cdr group-num)))))
174 (setq path (nnml-article-to-file id))) 174 (setq path (nnml-article-to-file id)))
175 (cond 175 (cond
176 ((not path) 176 ((not path)
177 (nnheader-report 'nnml "No such article: %s" id)) 177 (nnheader-report 'nnml "No such article: %s" id))
178 ((not (file-exists-p path)) 178 ((not (file-exists-p path))
179 (nnheader-report 'nnml "No such file: %s" path)) 179 (nnheader-report 'nnml "No such file: %s" path))
180 ((file-directory-p path) 180 ((file-directory-p path)
186 ;; We return the article number. 186 ;; We return the article number.
187 (cons (if group-num (car group-num) group) 187 (cons (if group-num (car group-num) group)
188 (string-to-int (file-name-nondirectory path))))))) 188 (string-to-int (file-name-nondirectory path)))))))
189 189
190 (deffoo nnml-request-group (group &optional server dont-check) 190 (deffoo nnml-request-group (group &optional server dont-check)
191 (cond 191 (cond
192 ((not (nnml-possibly-change-directory group server)) 192 ((not (nnml-possibly-change-directory group server))
193 (nnheader-report 'nnml "Invalid group (no such directory)")) 193 (nnheader-report 'nnml "Invalid group (no such directory)"))
194 ((not (file-exists-p nnml-current-directory)) 194 ((not (file-exists-p nnml-current-directory))
195 (nnheader-report 'nnml "Directory %s does not exist" 195 (nnheader-report 'nnml "Directory %s does not exist"
196 nnml-current-directory)) 196 nnml-current-directory))
197 ((not (file-directory-p nnml-current-directory)) 197 ((not (file-directory-p nnml-current-directory))
198 (nnheader-report 'nnml "%s is not a directory" nnml-current-directory)) 198 (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
199 (dont-check 199 (dont-check
200 (nnheader-report 'nnml "Group %s selected" group) 200 (nnheader-report 'nnml "Group %s selected" group)
201 t) 201 t)
202 (t 202 (t
203 (nnheader-re-read-dir nnml-current-directory) 203 (nnheader-re-read-dir nnml-current-directory)
204 (nnmail-activate 'nnml) 204 (nnmail-activate 'nnml)
205 (let ((active (nth 1 (assoc group nnml-group-alist)))) 205 (let ((active (nth 1 (assoc group nnml-group-alist))))
206 (if (not active) 206 (if (not active)
207 (nnheader-report 'nnml "No such group: %s" group) 207 (nnheader-report 'nnml "No such group: %s" group)
208 (nnheader-report 'nnml "Selected group %s" group) 208 (nnheader-report 'nnml "Selected group %s" group)
209 (nnheader-insert "211 %d %d %d %s\n" 209 (nnheader-insert "211 %d %d %d %s\n"
210 (max (1+ (- (cdr active) (car active))) 0) 210 (max (1+ (- (cdr active) (car active))) 0)
211 (car active) (cdr active) group)))))) 211 (car active) (cdr active) group))))))
212 212
213 (deffoo nnml-request-scan (&optional group server) 213 (deffoo nnml-request-scan (&optional group server)
214 (setq nnml-article-file-alist nil) 214 (setq nnml-article-file-alist nil)
248 (nnmail-find-file nnml-newsgroups-file))) 248 (nnmail-find-file nnml-newsgroups-file)))
249 249
250 (deffoo nnml-request-expire-articles (articles group 250 (deffoo nnml-request-expire-articles (articles group
251 &optional server force) 251 &optional server force)
252 (nnml-possibly-change-directory group server) 252 (nnml-possibly-change-directory group server)
253 (let* ((active-articles 253 (let* ((active-articles
254 (nnheader-directory-articles nnml-current-directory)) 254 (nnheader-directory-articles nnml-current-directory))
255 (is-old t) 255 (is-old t)
256 article rest mod-time number) 256 article rest mod-time number)
257 (nnmail-activate 'nnml) 257 (nnmail-activate 'nnml)
258 258
259 (while (and articles is-old) 259 (while (and articles is-old)
260 (when (setq article (nnml-article-to-file (setq number (pop articles)))) 260 (when (setq article (nnml-article-to-file (setq number (pop articles))))
261 (when (setq mod-time (nth 5 (file-attributes article))) 261 (when (setq mod-time (nth 5 (file-attributes article)))
262 (if (and (nnml-deletable-article-p group number) 262 (if (and (nnml-deletable-article-p group number)
263 (setq is-old 263 (setq is-old
264 (nnmail-expired-article-p group mod-time force 264 (nnmail-expired-article-p group mod-time force
265 nnml-inhibit-expiry))) 265 nnml-inhibit-expiry)))
266 (progn 266 (progn
267 (nnheader-message 5 "Deleting article %s in %s" 267 (nnheader-message 5 "Deleting article %s in %s"
268 article group) 268 article group)
280 (1+ (cdr active))))) 280 (1+ (cdr active)))))
281 (nnmail-save-active nnml-group-alist nnml-active-file)) 281 (nnmail-save-active nnml-group-alist nnml-active-file))
282 (nnml-save-nov) 282 (nnml-save-nov)
283 (nconc rest articles))) 283 (nconc rest articles)))
284 284
285 (deffoo nnml-request-move-article 285 (deffoo nnml-request-move-article
286 (article group server accept-form &optional last) 286 (article group server accept-form &optional last)
287 (let ((buf (get-buffer-create " *nnml move*")) 287 (let ((buf (get-buffer-create " *nnml move*"))
288 result) 288 result)
289 (nnml-possibly-change-directory group server) 289 (nnml-possibly-change-directory group server)
290 (nnml-update-file-alist) 290 (nnml-update-file-alist)
291 (and 291 (and
292 (nnml-deletable-article-p group article) 292 (nnml-deletable-article-p group article)
293 (nnml-request-article article group server) 293 (nnml-request-article article group server)
294 (save-excursion 294 (save-excursion
295 (set-buffer buf) 295 (set-buffer buf)
296 (insert-buffer-substring nntp-server-buffer) 296 (insert-buffer-substring nntp-server-buffer)
311 311
312 (deffoo nnml-request-accept-article (group &optional server last) 312 (deffoo nnml-request-accept-article (group &optional server last)
313 (nnml-possibly-change-directory group server) 313 (nnml-possibly-change-directory group server)
314 (nnmail-check-syntax) 314 (nnmail-check-syntax)
315 (let (result) 315 (let (result)
316 (nnmail-cache-insert (nnmail-fetch-field "message-id"))
316 (if (stringp group) 317 (if (stringp group)
317 (and 318 (and
318 (nnmail-activate 'nnml) 319 (nnmail-activate 'nnml)
319 (setq result (car (nnml-save-mail 320 (setq result (car (nnml-save-mail
320 (list (cons group (nnml-active-number group)))))) 321 (list (cons group (nnml-active-number group))))))
321 (progn 322 (progn
322 (nnmail-save-active nnml-group-alist nnml-active-file) 323 (nnmail-save-active nnml-group-alist nnml-active-file)
323 (and last (nnml-save-nov)))) 324 (and last (nnml-save-nov))))
324 (and 325 (and
325 (nnmail-activate 'nnml) 326 (nnmail-activate 'nnml)
326 (setq result (car (nnml-save-mail 327 (setq result (car (nnml-save-mail
327 (nnmail-article-group 'nnml-active-number)))) 328 (nnmail-article-group 'nnml-active-number))))
328 (progn 329 (when last
329 (nnmail-save-active nnml-group-alist nnml-active-file) 330 (nnmail-save-active nnml-group-alist nnml-active-file)
330 (and last (nnml-save-nov))))) 331 (nnmail-cache-close)
332 (nnml-save-nov))))
331 result)) 333 result))
332 334
333 (deffoo nnml-request-replace-article (article group buffer) 335 (deffoo nnml-request-replace-article (article group buffer)
334 (nnml-possibly-change-directory group) 336 (nnml-possibly-change-directory group)
335 (save-excursion 337 (save-excursion
338 (let ((chars (nnmail-insert-lines)) 340 (let ((chars (nnmail-insert-lines))
339 (art (concat (int-to-string article) "\t")) 341 (art (concat (int-to-string article) "\t"))
340 headers) 342 headers)
341 (when (condition-case () 343 (when (condition-case ()
342 (progn 344 (progn
343 (nnmail-write-region 345 (nnmail-write-region
344 (point-min) (point-max) 346 (point-min) (point-max)
345 (or (nnml-article-to-file article) 347 (or (nnml-article-to-file article)
346 (concat nnml-current-directory 348 (concat nnml-current-directory
347 (int-to-string article))) 349 (int-to-string article)))
348 nil (if (nnheader-be-verbose 5) nil 'nomesg)) 350 nil (if (nnheader-be-verbose 5) nil 'nomesg))
349 t) 351 t)
350 (error nil)) 352 (error nil))
351 (setq headers (nnml-parse-head chars article)) 353 (setq headers (nnml-parse-head chars article))
352 ;; Replace the NOV line in the NOV file. 354 ;; Replace the NOV line in the NOV file.
353 (save-excursion 355 (save-excursion
354 (set-buffer (nnml-open-nov group)) 356 (set-buffer (nnml-open-nov group))
355 (goto-char (point-min)) 357 (goto-char (point-min))
356 (if (or (looking-at art) 358 (if (or (looking-at art)
357 (search-forward (concat "\n" art) nil t)) 359 (search-forward (concat "\n" art) nil t))
358 ;; Delete the old NOV line. 360 ;; Delete the old NOV line.
360 (progn (forward-line 1) (point))) 362 (progn (forward-line 1) (point)))
361 ;; The line isn't here, so we have to find out where 363 ;; The line isn't here, so we have to find out where
362 ;; we should insert it. (This situation should never 364 ;; we should insert it. (This situation should never
363 ;; occur, but one likes to make sure...) 365 ;; occur, but one likes to make sure...)
364 (while (and (looking-at "[0-9]+\t") 366 (while (and (looking-at "[0-9]+\t")
365 (< (string-to-int 367 (< (string-to-int
366 (buffer-substring 368 (buffer-substring
367 (match-beginning 0) (match-end 0))) 369 (match-beginning 0) (match-end 0)))
368 article) 370 article)
369 (zerop (forward-line 1))))) 371 (zerop (forward-line 1)))))
370 (beginning-of-line) 372 (beginning-of-line)
371 (nnheader-insert-nov headers) 373 (nnheader-insert-nov headers)
374 376
375 (deffoo nnml-request-delete-group (group &optional force server) 377 (deffoo nnml-request-delete-group (group &optional force server)
376 (nnml-possibly-change-directory group server) 378 (nnml-possibly-change-directory group server)
377 (when force 379 (when force
378 ;; Delete all articles in GROUP. 380 ;; Delete all articles in GROUP.
379 (let ((articles 381 (let ((articles
380 (directory-files 382 (directory-files
381 nnml-current-directory t 383 nnml-current-directory t
382 (concat nnheader-numerical-short-files 384 (concat nnheader-numerical-short-files
383 "\\|" (regexp-quote nnml-nov-file-name) "$"))) 385 "\\|" (regexp-quote nnml-nov-file-name) "$")))
384 article) 386 article)
385 (while articles 387 (while articles
386 (setq article (pop articles)) 388 (setq article (pop articles))
387 (when (file-writable-p article) 389 (when (file-writable-p article)
388 (nnheader-message 5 "Deleting article %s in %s..." article group) 390 (nnheader-message 5 "Deleting article %s in %s..." article group)
389 (funcall nnmail-delete-file-function article)))) 391 (funcall nnmail-delete-file-function article))))
390 ;; Try to delete the directory itself. 392 ;; Try to delete the directory itself.
391 (condition-case () 393 (condition-case ()
392 (delete-directory nnml-current-directory) 394 (delete-directory nnml-current-directory)
393 (error nil))) 395 (error nil)))
394 ;; Remove the group from all structures. 396 ;; Remove the group from all structures.
395 (setq nnml-group-alist 397 (setq nnml-group-alist
396 (delq (assoc group nnml-group-alist) nnml-group-alist) 398 (delq (assoc group nnml-group-alist) nnml-group-alist)
397 nnml-current-group nil 399 nnml-current-group nil
398 nnml-current-directory nil) 400 nnml-current-directory nil)
399 ;; Save the active file. 401 ;; Save the active file.
400 (nnmail-save-active nnml-group-alist nnml-active-file) 402 (nnmail-save-active nnml-group-alist nnml-active-file)
412 ;; We move the articles file by file instead of renaming 414 ;; We move the articles file by file instead of renaming
413 ;; the directory -- there may be subgroups in this group. 415 ;; the directory -- there may be subgroups in this group.
414 ;; One might be more clever, I guess. 416 ;; One might be more clever, I guess.
415 (let ((files (nnheader-article-to-file-alist old-dir))) 417 (let ((files (nnheader-article-to-file-alist old-dir)))
416 (while files 418 (while files
417 (rename-file 419 (rename-file
418 (concat old-dir (cdar files)) 420 (concat old-dir (cdar files))
419 (concat new-dir (cdar files))) 421 (concat new-dir (cdar files)))
420 (pop files))) 422 (pop files)))
421 ;; Move .overview file. 423 ;; Move .overview file.
422 (let ((overview (concat old-dir nnml-nov-file-name))) 424 (let ((overview (concat old-dir nnml-nov-file-name)))
464 (when (file-writable-p path) 466 (when (file-writable-p path)
465 (or (not nnmail-keep-last-article) 467 (or (not nnmail-keep-last-article)
466 (not (eq (cdr (nth 1 (assoc group nnml-group-alist))) 468 (not (eq (cdr (nth 1 (assoc group nnml-group-alist)))
467 article))))))) 469 article)))))))
468 470
469 ;; Find an article number in the current group given the Message-ID. 471 ;; Find an article number in the current group given the Message-ID.
470 (defun nnml-find-group-number (id) 472 (defun nnml-find-group-number (id)
471 (save-excursion 473 (save-excursion
472 (set-buffer (get-buffer-create " *nnml id*")) 474 (set-buffer (get-buffer-create " *nnml id*"))
473 (buffer-disable-undo (current-buffer)) 475 (buffer-disable-undo (current-buffer))
474 (let ((alist nnml-group-alist) 476 (let ((alist nnml-group-alist)
475 number) 477 number)
476 ;; We want to look through all .overview files, but we want to 478 ;; We want to look through all .overview files, but we want to
477 ;; start with the one in the current directory. It seems most 479 ;; start with the one in the current directory. It seems most
478 ;; likely that the article we are looking for is in that group. 480 ;; likely that the article we are looking for is in that group.
479 (if (setq number (nnml-find-id nnml-current-group id)) 481 (if (setq number (nnml-find-id nnml-current-group id))
480 (cons nnml-current-group number) 482 (cons nnml-current-group number)
481 ;; It wasn't there, so we look through the other groups as well. 483 ;; It wasn't there, so we look through the other groups as well.
482 (while (and (not number) 484 (while (and (not number)
483 alist) 485 alist)
549 (setq dir (file-name-directory (directory-file-name dir)))) 551 (setq dir (file-name-directory (directory-file-name dir))))
550 (while dirs 552 (while dirs
551 (make-directory (directory-file-name (car dirs))) 553 (make-directory (directory-file-name (car dirs)))
552 (nnheader-message 5 "Creating mail directory %s" (car dirs)) 554 (nnheader-message 5 "Creating mail directory %s" (car dirs))
553 (setq dirs (cdr dirs))))) 555 (setq dirs (cdr dirs)))))
554 556
555 (defun nnml-save-mail (group-art) 557 (defun nnml-save-mail (group-art)
556 "Called narrowed to an article." 558 "Called narrowed to an article."
557 (let (chars headers) 559 (let (chars headers)
558 (setq chars (nnmail-insert-lines)) 560 (setq chars (nnmail-insert-lines))
559 (nnmail-insert-xref group-art) 561 (nnmail-insert-xref group-art)
566 ;; We save the article in all the groups it belongs in. 568 ;; We save the article in all the groups it belongs in.
567 (let ((ga group-art) 569 (let ((ga group-art)
568 first) 570 first)
569 (while ga 571 (while ga
570 (nnml-possibly-create-directory (caar ga)) 572 (nnml-possibly-create-directory (caar ga))
571 (let ((file (concat (nnmail-group-pathname 573 (let ((file (concat (nnmail-group-pathname
572 (caar ga) nnml-directory) 574 (caar ga) nnml-directory)
573 (int-to-string (cdar ga))))) 575 (int-to-string (cdar ga)))))
574 (if first 576 (if first
575 ;; It was already saved, so we just make a hard link. 577 ;; It was already saved, so we just make a hard link.
576 (funcall nnmail-crosspost-link-function first file t) 578 (funcall nnmail-crosspost-link-function first file t)
577 ;; Save the article. 579 ;; Save the article.
578 (nnmail-write-region (point-min) (point-max) file nil 580 (nnmail-write-region (point-min) (point-max) file nil
579 (if (nnheader-be-verbose 5) nil 'nomesg)) 581 (if (nnheader-be-verbose 5) nil 'nomesg))
580 (setq first file))) 582 (setq first file)))
581 (setq ga (cdr ga)))) 583 (setq ga (cdr ga))))
582 ;; Generate a nov line for this article. We generate the nov 584 ;; Generate a nov line for this article. We generate the nov
583 ;; line after saving, because nov generation destroys the 585 ;; line after saving, because nov generation destroys the
584 ;; header. 586 ;; header.
585 (setq headers (nnml-parse-head chars)) 587 (setq headers (nnml-parse-head chars))
586 ;; Output the nov line to all nov databases that should have it. 588 ;; Output the nov line to all nov databases that should have it.
587 (let ((ga group-art)) 589 (let ((ga group-art))
588 (while ga 590 (while ga
589 (nnml-add-nov (caar ga) (cdar ga) headers) 591 (nnml-add-nov (caar ga) (cdar ga) headers)
592 594
593 (defun nnml-active-number (group) 595 (defun nnml-active-number (group)
594 "Compute the next article number in GROUP." 596 "Compute the next article number in GROUP."
595 (let ((active (cadr (assoc group nnml-group-alist)))) 597 (let ((active (cadr (assoc group nnml-group-alist))))
596 ;; The group wasn't known to nnml, so we just create an active 598 ;; The group wasn't known to nnml, so we just create an active
597 ;; entry for it. 599 ;; entry for it.
598 (unless active 600 (unless active
599 ;; Perhaps the active file was corrupt? See whether 601 ;; Perhaps the active file was corrupt? See whether
600 ;; there are any articles in this group. 602 ;; there are any articles in this group.
601 (nnml-possibly-create-directory group) 603 (nnml-possibly-create-directory group)
602 (nnml-possibly-change-directory group) 604 (nnml-possibly-change-directory group)
618 (setcdr active (1+ (cdr active)))) 620 (setcdr active (1+ (cdr active))))
619 (cdr active))) 621 (cdr active)))
620 622
621 (defun nnml-add-nov (group article headers) 623 (defun nnml-add-nov (group article headers)
622 "Add a nov line for the GROUP base." 624 "Add a nov line for the GROUP base."
623 (save-excursion 625 (save-excursion
624 (set-buffer (nnml-open-nov group)) 626 (set-buffer (nnml-open-nov group))
625 (goto-char (point-max)) 627 (goto-char (point-max))
626 (mail-header-set-number headers article) 628 (mail-header-set-number headers article)
627 (nnheader-insert-nov headers))) 629 (nnheader-insert-nov headers)))
628 630
632 (defun nnml-parse-head (chars &optional number) 634 (defun nnml-parse-head (chars &optional number)
633 "Parse the head of the current buffer." 635 "Parse the head of the current buffer."
634 (save-excursion 636 (save-excursion
635 (save-restriction 637 (save-restriction
636 (goto-char (point-min)) 638 (goto-char (point-min))
637 (narrow-to-region 639 (narrow-to-region
638 (point) 640 (point)
639 (1- (or (search-forward "\n\n" nil t) (point-max)))) 641 (1- (or (search-forward "\n\n" nil t) (point-max))))
640 ;; Fold continuation lines. 642 ;; Fold continuation lines.
641 (goto-char (point-min)) 643 (goto-char (point-min))
642 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t) 644 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
648 (mail-header-set-number headers number) 650 (mail-header-set-number headers number)
649 headers)))) 651 headers))))
650 652
651 (defun nnml-open-nov (group) 653 (defun nnml-open-nov (group)
652 (or (cdr (assoc group nnml-nov-buffer-alist)) 654 (or (cdr (assoc group nnml-nov-buffer-alist))
653 (let ((buffer (nnheader-find-file-noselect 655 (let ((buffer (nnheader-find-file-noselect
654 (concat (nnmail-group-pathname group nnml-directory) 656 (concat (nnmail-group-pathname group nnml-directory)
655 nnml-nov-file-name)))) 657 nnml-nov-file-name))))
656 (save-excursion 658 (save-excursion
657 (set-buffer buffer) 659 (set-buffer buffer)
658 (buffer-disable-undo (current-buffer))) 660 (buffer-disable-undo (current-buffer)))
672 674
673 ;;;###autoload 675 ;;;###autoload
674 (defun nnml-generate-nov-databases () 676 (defun nnml-generate-nov-databases ()
675 "Generate nov databases in all nnml directories." 677 "Generate nov databases in all nnml directories."
676 (interactive) 678 (interactive)
677 ;; Read the active file to make sure we don't re-use articles 679 ;; Read the active file to make sure we don't re-use articles
678 ;; numbers in empty groups. 680 ;; numbers in empty groups.
679 (nnmail-activate 'nnml) 681 (nnmail-activate 'nnml)
680 (nnml-open-server (or (nnoo-current-server 'nnml) "")) 682 (nnml-open-server (or (nnoo-current-server 'nnml) ""))
681 (setq nnml-directory (expand-file-name nnml-directory)) 683 (setq nnml-directory (expand-file-name nnml-directory))
682 ;; Recurse down the directories. 684 ;; Recurse down the directories.
705 (nnml-generate-nov-file dir files))))) 707 (nnml-generate-nov-file dir files)))))
706 708
707 (defvar files) 709 (defvar files)
708 (defun nnml-generate-active-info (dir) 710 (defun nnml-generate-active-info (dir)
709 ;; Update the active info for this group. 711 ;; Update the active info for this group.
710 (let ((group (nnheader-file-to-group 712 (let ((group (nnheader-file-to-group
711 (directory-file-name dir) nnml-directory))) 713 (directory-file-name dir) nnml-directory)))
712 (setq nnml-group-alist 714 (setq nnml-group-alist
713 (delq (assoc group nnml-group-alist) nnml-group-alist)) 715 (delq (assoc group nnml-group-alist) nnml-group-alist))
714 (push (list group 716 (push (list group
715 (cons (caar files) 717 (cons (caar files)
734 (funcall nnmail-delete-file-function nov)) 736 (funcall nnmail-delete-file-function nov))
735 (while files 737 (while files
736 (unless (file-directory-p (setq file (concat dir (cdar files)))) 738 (unless (file-directory-p (setq file (concat dir (cdar files))))
737 (erase-buffer) 739 (erase-buffer)
738 (nnheader-insert-file-contents file) 740 (nnheader-insert-file-contents file)
739 (narrow-to-region 741 (narrow-to-region
740 (goto-char (point-min)) 742 (goto-char (point-min))
741 (progn 743 (progn
742 (search-forward "\n\n" nil t) 744 (search-forward "\n\n" nil t)
743 (setq chars (- (point-max) (point))) 745 (setq chars (- (point-max) (point)))
744 (max 1 (1- (point))))) 746 (max 1 (1- (point)))))