(gnus-cache-file-name): Do not replace file name character in base path.
[elisp/gnus.git-] / lisp / nnmh.el
index 769d865..0adde1f 100644 (file)
@@ -1,5 +1,5 @@
 ;;; nnmh.el --- mhspool access for Gnus
-;; Copyright (C) 1995,96,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
@@ -60,7 +60,7 @@
 
 (defvoo nnmh-status-string "")
 (defvoo nnmh-group-alist nil)
-(defvoo nnmh-allow-delete-final nil)
+(defvar nnmh-allow-delete-final nil)
 
 \f
 
               '<))
          (cond
           (dir
+           (setq nnmh-group-alist
+                 (delq (assoc group nnmh-group-alist) nnmh-group-alist))
+           (push (list group (cons (car dir) (car (last dir))))
+                 nnmh-group-alist)
            (nnheader-report 'nnmh "Selected group %s" group)
            (nnheader-insert
             "211 %d %d %d %s\n" (length dir) (car dir)
-            (progn (while (cdr dir) (setq dir (cdr dir))) (car dir))
-            group))
+            (car (last dir)) group))
           (t
            (nnheader-report 'nnmh "Empty group %s" group)
            (nnheader-insert (format "211 0 1 0 %s\n" group))))))))))
   "Compute the next article number in GROUP."
   (let ((active (cadr (assoc group nnmh-group-alist)))
        (dir (nnmail-group-pathname group nnmh-directory))
-       (pathname-coding-system 'binary))
+       (pathname-coding-system 'binary)
+       file)
     (unless active
       ;; The group wasn't known to nnmh, so we just create an active
       ;; entry for it.
        (when files
          (setcdr active (car files)))))
     (setcdr active (1+ (cdr active)))
-    (while (file-exists-p
-           (concat (nnmail-group-pathname group nnmh-directory)
-                   (int-to-string (cdr active))))
+    (while (or
+           ;; See whether the file exists...
+           (file-exists-p
+            (setq file (concat (nnmail-group-pathname group nnmh-directory)
+                               (int-to-string (cdr active)))))
+           ;; ... or there is a buffer that will make that file exist
+           ;; in the future.
+           (get-file-buffer file))
+      ;; Skip past that file.
       (setcdr active (1+ (cdr active))))
     (cdr active)))