(gnus-parse-complex-format): %~ => ~*.
[gnus] / lisp / nnmaildir.el
index 4a130d9..050010b 100644 (file)
@@ -248,13 +248,14 @@ by nnmaildir-request-article.")
   (delete-directory dir))
 
 (defun nnmaildir--group-maxnum (server group)
-  (let ((x (nnmaildir--srvgrp-dir (nnmaildir--srv-dir server)
-                                 (nnmaildir--grp-name group))))
-    (setq x (nnmaildir--nndir x)
-         x (nnmaildir--num-dir x)
-         x (nnmaildir--num-file x)
-         x (file-attributes x))
-    (if x (1- (nth 1 x)) 0)))
+  (if (zerop (nnmaildir--grp-count group)) 0
+    (let ((x (nnmaildir--srvgrp-dir (nnmaildir--srv-dir server)
+                                   (nnmaildir--grp-name group))))
+      (setq x (nnmaildir--nndir x)
+           x (nnmaildir--num-dir x)
+           x (nnmaildir--num-file x)
+           x (file-attributes x))
+      (if x (1- (nth 1 x)) 0))))
 
 ;; Make the given server, if non-nil, be the current server.  Then make the
 ;; given group, if non-nil, be the current group of the current server.  Then
@@ -370,8 +371,7 @@ by nnmaildir-request-article.")
            (setq nov-mid 0))
          (goto-char (point-min))
          (delete-char 1)
-         (nnheader-fold-continuation-lines)
-         (setq nov (nnheader-parse-head 'naked)
+         (setq nov (nnheader-parse-naked-head)
                field (or (mail-header-lines nov) 0)))
        (unless (or (zerop field) (nnmaildir--param pgname 'distrust-Lines:))
          (setq nov-mid field))
@@ -454,10 +454,10 @@ by nnmaildir-request-article.")
        count num min nlist nlist-cdr insert-nlist)
     (when nov
       (setq count (1+ (nnmaildir--grp-count group))
-           min (nnmaildir--grp-min group)
-           num (nnmaildir--art-num article))
-      (setq min (min min num))
-      (setq nlist (nnmaildir--grp-nlist group))
+           num (nnmaildir--art-num article)
+           min (if (= count 1) num
+                 (min num (nnmaildir--grp-min group)))
+           nlist (nnmaildir--grp-nlist group))
       (if (or (null nlist) (> num (caar nlist)))
          (setq nlist (cons (cons num article) nlist))
        (setq insert-nlist t
@@ -924,16 +924,16 @@ by nnmaildir-request-article.")
 (defun nnmaildir-request-group (gname &optional server fast)
   (let ((group (nnmaildir--prepare server gname))
        deactivate-mark)
-    (nnmaildir--with-nntp-buffer
-      (erase-buffer)
-      (catch 'return
-       (unless group
-         (insert "411 no such news group\n")
-         (setf (nnmaildir--srv-error nnmaildir--cur-server)
-               (concat "No such group: " gname))
-         (throw 'return nil))
-       (setf (nnmaildir--srv-curgrp nnmaildir--cur-server) group)
-       (if fast (throw 'return t))
+    (catch 'return
+      (unless group
+       ;; (insert "411 no such news group\n")
+       (setf (nnmaildir--srv-error nnmaildir--cur-server)
+             (concat "No such group: " gname))
+       (throw 'return nil))
+      (setf (nnmaildir--srv-curgrp nnmaildir--cur-server) group)
+      (if fast (throw 'return t))
+      (nnmaildir--with-nntp-buffer
+       (erase-buffer)
        (insert "211 ")
        (princ (nnmaildir--grp-count group) nntp-server-buffer)
        (insert " ")