Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / nnmaildir.el
index 2d21303..e9d5ef5 100644 (file)
@@ -700,9 +700,11 @@ by nnmaildir-request-article.")
 
 (defun nnmaildir-request-scan (&optional scan-group server)
   (let ((coding-system-for-write nnheader-file-coding-system)
+       (output-coding-system nnheader-file-coding-system)
        (buffer-file-coding-system nil)
+       (file-coding-system nil)
        (file-coding-system-alist nil)
-       (nnmaildir-new-mail t)
+       (nnmaildir-get-new-mail t)
        (nnmaildir-group-alist nil)
        (nnmaildir-active-file nil)
        x srv-ls srv-dir method groups group dirs grp-dir seen deactivate-mark)
@@ -718,20 +720,20 @@ by nnmaildir-request-article.")
                (if (nnmaildir--srv-gnm nnmaildir--cur-server)
                    (nnmail-get-new-mail 'nnmaildir nil nil scan-group))
              (unintern scan-group groups))
-         (setq x (nth 5 (file-attributes srv-dir)))
+         (setq x (nth 5 (file-attributes srv-dir))
+               scan-group (null scan-group))
          (if (equal x (nnmaildir--srv-mtime nnmaildir--cur-server))
-             (if scan-group nil
-               (mapatoms (lambda (sym)
-                           (nnmaildir--scan (symbol-name sym) t groups
-                                            method srv-dir srv-ls))
-                         groups))
+             (if scan-group
+                 (mapatoms (lambda (sym)
+                             (nnmaildir--scan (symbol-name sym) t groups
+                                              method srv-dir srv-ls))
+                           groups))
            (setq dirs (funcall srv-ls srv-dir nil "\\`[^.]" 'nosort)
                  x (length dirs)
                  seen 1)
            (while (<= seen x) (setq seen (* 2 seen)))
            (if (/= seen 1) (setq seen (1- seen)))
-           (setq seen (make-vector seen 0)
-                 scan-group (null scan-group))
+           (setq seen (make-vector seen 0))
            (while dirs
              (setq grp-dir (car dirs) dirs (cdr dirs))
              (if (nnmaildir--scan grp-dir scan-group groups method srv-dir
@@ -748,8 +750,9 @@ by nnmaildir-request-article.")
              (setq x (cdr x)))
            (setf (nnmaildir--srv-mtime nnmaildir--cur-server)
                  (nth 5 (file-attributes srv-dir))))
-         (if (nnmaildir--srv-gnm nnmaildir--cur-server)
-             (nnmail-get-new-mail 'nnmaildir nil nil))))))
+         (and scan-group
+              (nnmaildir--srv-gnm nnmaildir--cur-server)
+              (nnmail-get-new-mail 'nnmaildir nil nil))))))
   t)
 
 (defun nnmaildir-request-list (&optional server)
@@ -785,7 +788,6 @@ by nnmaildir-request-article.")
       (erase-buffer)
       (while groups
        (setq gname (car groups) groups (cdr groups))
-       (nnmaildir-request-scan gname server)
        (setq group (nnmaildir--prepare nil gname))
        (if (null group) (insert "411 no such news group\n")
          (setq ct-min (nnmaildir--article-count group))
@@ -802,7 +804,6 @@ by nnmaildir-request-article.")
   'group)
 
 (defun nnmaildir-request-update-info (gname info &optional server)
-  (nnmaildir-request-scan gname server)
   (let ((group (nnmaildir--prepare server gname))
        pgname nlist flist last always-marks never-marks old-marks dotfile num
         dir markdirs marks mark ranges articles article read end new-marks ls
@@ -869,7 +870,6 @@ by nnmaildir-request-article.")
       info)))
 
 (defun nnmaildir-request-group (gname &optional server fast)
-  (nnmaildir-request-scan gname server)
   (let ((group (nnmaildir--prepare server gname))
        ct-min deactivate-mark)
     (nnmaildir--with-nntp-buffer
@@ -936,7 +936,9 @@ by nnmaildir-request-article.")
 (defun nnmaildir-request-rename-group (gname new-name &optional server)
   (let ((group (nnmaildir--prepare server gname))
        (coding-system-for-write nnheader-file-coding-system)
+       (output-coding-system nnheader-file-coding-system)
        (buffer-file-coding-system nil)
+       (file-coding-system nil)
        (file-coding-system-alist nil)
        srv-dir x groups)
     (catch 'return
@@ -1203,7 +1205,9 @@ by nnmaildir-request-article.")
 (defun nnmaildir-request-replace-article (article gname buffer)
   (let ((group (nnmaildir--prepare nil gname))
        (coding-system-for-write nnheader-file-coding-system)
+       (output-coding-system nnheader-file-coding-system)
        (buffer-file-coding-system nil)
+       (file-coding-system nil)
        (file-coding-system-alist nil)
        file dir suffix tmpfile deactivate-mark)
     (catch 'return
@@ -1289,7 +1293,9 @@ by nnmaildir-request-article.")
 (defun nnmaildir-request-accept-article (gname &optional server last)
   (let ((group (nnmaildir--prepare server gname))
        (coding-system-for-write nnheader-file-coding-system)
+       (output-coding-system nnheader-file-coding-system)
        (buffer-file-coding-system nil)
+       (file-coding-system nil)
        (file-coding-system-alist nil)
        srv-dir dir file tmpfile curfile 24h num article)
     (catch 'return
@@ -1502,7 +1508,9 @@ by nnmaildir-request-article.")
 (defun nnmaildir-request-set-mark (gname actions &optional server)
   (let ((group (nnmaildir--prepare server gname))
        (coding-system-for-write nnheader-file-coding-system)
+       (output-coding-system nnheader-file-coding-system)
        (buffer-file-coding-system nil)
+       (file-coding-system nil)
        (file-coding-system-alist nil)
        del-mark add-marks marksdir markfile action group-nlist nlist ranges
        begin end article all-marks todo-marks did-marks marks form mdir mfile