Remove `exist' marks that come from old Gnusae.
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 1 Feb 2012 14:46:25 +0000 (15:46 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 1 Feb 2012 14:46:25 +0000 (15:46 +0100)
This makes it possible to switch back and forth without losing track
of nnimap `exist' information.

* gnus-start.el (gnus-clean-old-newsrc): New function.
(gnus-read-newsrc-file): Use it.

lisp/ChangeLog
lisp/gnus-start.el

index b1a3ecb..17fe812 100644 (file)
@@ -1,5 +1,8 @@
 2012-02-01  Lars Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-start.el (gnus-clean-old-newsrc): New function.
+       (gnus-read-newsrc-file): Use it.
+
        * mm-archive.el (mm-dissect-archive): Use it to get all file names.
        Use recursive deletion.
        (mm-dissect-archive): Add support for zip files.
index 801f772..cfedeb1 100644 (file)
@@ -2303,7 +2303,19 @@ If FORCE is non-nil, the .newsrc file is read."
          (gnus-message 5 "Reading %s...done" newsrc-file)))
 
       ;; Convert old to new.
-      (gnus-convert-old-newsrc))))
+      (gnus-convert-old-newsrc)
+      (gnus-clean-old-newsrc))))
+
+(defun gnus-clean-old-newsrc ()
+  (when gnus-newsrc-file-version
+    (when (< (gnus-continuum-version gnus-newsrc-file-version)
+            (gnus-continuum-version "Ma Gnus v0.02"))
+      ;; Remove old `exist' marks from old nnimap groups.
+      (dolist (info (cdr gnus-newsrc-alist))
+       (let ((exist (assoc 'exist (gnus-info-marks info))))
+         (when exist
+           (gnus-info-set-marks
+            info (delete exist (gnus-info-marks info)))))))))
 
 (defun gnus-convert-old-newsrc ()
   "Convert old newsrc formats into the current format, if needed."