gnus-sync.el (gnus-sync): Fix defgroup version.
[gnus] / lisp / gnus-sync.el
index 236a874..e68b3d8 100644 (file)
@@ -1,7 +1,6 @@
 ;;; gnus-sync.el --- synchronization facility for Gnus
 
-;;; Copyright (C) 2010
-;;; Free Software Foundation, Inc.
+;; Copyright (C) 2010  Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <tzz@lifelogs.com>
 ;; Keywords: news synchronization nntp nnrss
 ;; Tramp over IMAP: /imaps:user@yourhosthere.com:/INBOX.test/filename
 ;; ...or any other file Tramp and Emacs can handle...
 
-;; (setq gnus-sync-backend `("/remote:/path.gpg") ; will use Tramp+EPA if loaded
+;; (setq gnus-sync-backend "/remote:/path.gpg" ; will use Tramp+EPA if loaded
 ;;       gnus-sync-global-vars `(gnus-newsrc-last-checked-date)
 ;;       gnus-sync-newsrc-groups `("nntp" "nnrss")
-;;       gnus-sync-newsrc-vars `(read marks))
+;;       gnus-sync-newsrc-offsets `(2 3))
 
 ;; TODO:
 
@@ -48,7 +47,7 @@
 
 (defgroup gnus-sync nil
   "The Gnus synchronization facility."
-  :version "23.1"
+  :version "24.1"
   :group 'gnus)
 
 (defcustom gnus-sync-newsrc-groups `("nntp" "nnrss")
@@ -96,15 +95,19 @@ synchronized, I believe).  Also see `gnus-variable-list'."
     ;; populate gnus-sync-newsrc-loader from all but the first dummy
     ;; entry in gnus-newsrc-alist whose group matches any of the
     ;; gnus-sync-newsrc-groups
-    (let ((gnus-sync-newsrc-loader
-           (loop for entry in (cdr gnus-newsrc-alist)
-                 when (gnus-grep-in-list
-                       (car entry)     ;the group name
-                       gnus-sync-newsrc-groups)
-                 collect (cons (car entry)
-                               (mapcar (lambda (offset)
-                                         (cons offset (nth offset entry)))
-                                       gnus-sync-newsrc-offsets)))))
+    (let* ((loader
+            (loop for entry in (cdr gnus-newsrc-alist)
+                  when (gnus-grep-in-list
+                        (car entry)     ;the group name
+                        gnus-sync-newsrc-groups)
+                  collect (cons (car entry)
+                                (mapcar (lambda (offset)
+                                          (cons offset (nth offset entry)))
+                                        gnus-sync-newsrc-offsets))))
+           (gnus-sync-newsrc-loader
+            (nunion loader
+                    (set-difference gnus-sync-newsrc-loader loader :key 'car)
+                    :key 'car)))
 
       (with-temp-file gnus-sync-backend
         (progn
@@ -125,13 +128,16 @@ synchronized, I believe).  Also see `gnus-variable-list'."
                                     gnus-sync-global-vars))
                    variable)
               (while variables
-                (when (and (boundp (setq variable (pop variables)))
+                (if (and (boundp (setq variable (pop variables)))
                            (symbol-value variable))
-                  (princ "\n(setq ")
-                  (princ (symbol-name variable))
-                  (princ " '")
-                  (prin1 (symbol-value variable))
-                  (princ ")\n"))))
+                    (progn
+                      (princ "\n(setq ")
+                      (princ (symbol-name variable))
+                      (princ " '")
+                      (prin1 (symbol-value variable))
+                      (princ ")\n"))
+                  (princ "\n;;; skipping empty variable ")
+                  (princ (symbol-name variable)))))
             (gnus-message
              7
              "gnus-sync: stored variables %s and %d groups in %s"
@@ -190,8 +196,7 @@ synchronized, I believe).  Also see `gnus-variable-list'."
                (length gnus-sync-newsrc-loader)
                gnus-sync-backend)
               (gnus-message 9 "gnus-sync: skipped groups: %s"
-                            (mapconcat 'identity invalid-groups ", ")))
-           (setq gnus-sync-newsrc-loader nil)))
+                            (mapconcat 'identity invalid-groups ", ")))))
           (nil))
     ;; make the hashtable again because the newsrc-alist may have been modified
     (when gnus-sync-newsrc-offsets