(gnus-article-edit-part): Work for the buffer configuration that provides
[gnus] / lisp / nnmaildir.el
index 7a268f2..628b4c5 100644 (file)
@@ -1,14 +1,15 @@
 ;;; nnmaildir.el --- maildir backend for Gnus
-;; Public domain.
+
+;; This file is in the public domain.
 
 ;; Author: Paul Jarc <prj@po.cwru.edu>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,9 +17,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
    )
 ]
 
+;; For Emacs < 22.2.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
 (eval-and-compile
   (require 'nnheader)
   (require 'gnus)
@@ -267,8 +270,8 @@ by nnmaildir-request-article.")
        (setq attr (file-attributes
                    (concat dir (number-to-string number-linked))))
        (or attr (throw 'return (1- number-linked)))
-       (if (/= ino-opened (nth 10 attr))
-           (setq number-opened number-linked))))))
+       (unless (equal ino-opened (nth 10 attr))
+         (setq number-opened number-linked))))))
 
 ;; 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
@@ -358,9 +361,9 @@ by nnmaildir-request-article.")
                  number-open number-link))
           ((nnmaildir--eexist-p err)
            (let ((attr (file-attributes path-link)))
-             (if (/= (nth 10 attr) ino-open)
-                 (setq number-open number-link
-                       number-link 0))))
+             (unless (equal (nth 10 attr) ino-open)
+               (setq number-open number-link
+                     number-link 0))))
           (t (signal (car err) (cdr err)))))))))
 
 (defun nnmaildir--update-nov (server group article)
@@ -741,7 +744,7 @@ by nnmaildir-request-article.")
            ls (or (nnmaildir--param pgname 'directory-files) srv-ls))
       (unless read-only
        (setq x (nth 11 (file-attributes tdir)))
-       (unless (and (= x (nth 11 nattr)) (= x (nth 11 cattr)))
+       (unless (and (equal x (nth 11 nattr)) (equal x (nth 11 cattr)))
          (setf (nnmaildir--srv-error nnmaildir--cur-server)
                (concat "Maildir spans filesystems: " absdir))
          (throw 'return nil))
@@ -921,7 +924,8 @@ by nnmaildir-request-article.")
   (let ((group (nnmaildir--prepare server gname))
        pgname flist always-marks never-marks old-marks dotfile num dir
        markdirs marks mark ranges markdir article read end new-marks ls
-       old-mmth new-mmth mtime mark-sym existing missing deactivate-mark)
+       old-mmth new-mmth mtime mark-sym existing missing deactivate-mark
+       article-list)
     (catch 'return
       (unless group
        (setf (nnmaildir--srv-error nnmaildir--cur-server)
@@ -969,12 +973,13 @@ by nnmaildir-request-article.")
            (setq ranges (assq mark-sym old-marks))
            (if ranges (setq ranges (cdr ranges)))
            (throw 'got-ranges nil))
+         (setq article-list nil)
          (dolist (prefix (funcall ls markdir nil "\\`[^.]" 'nosort))
            (setq article (nnmaildir--flist-art flist prefix))
            (if article
-               (setq ranges
-                     (gnus-add-to-range ranges
-                                        `(,(nnmaildir--art-num article)))))))
+               (setq article-list
+                     (cons (nnmaildir--art-num article) article-list))))
+         (setq ranges (gnus-add-to-range ranges (sort article-list '<))))
        (if (eq mark-sym 'read) (setq read ranges)
          (if ranges (setq marks (cons (cons mark-sym ranges) marks)))))
       (gnus-info-set-read info (gnus-range-add read missing))
@@ -1436,6 +1441,8 @@ by nnmaildir-request-article.")
 (defun nnmaildir-active-number (gname)
   0)
 
+(declare-function gnus-group-mark-article-read "gnus-group" (group article))
+
 (defun nnmaildir-request-expire-articles (ranges &optional gname server force)
   (let ((no-force (not force))
        (group (nnmaildir--prepare server gname))
@@ -1660,5 +1667,5 @@ by nnmaildir-request-article.")
 ;; fill-column: 77
 ;; End:
 
-;;; arch-tag: 0c4e44cd-dfde-4040-888e-5597ec771849
+;; arch-tag: 0c4e44cd-dfde-4040-888e-5597ec771849
 ;;; nnmaildir.el ends here