X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-sync.el;h=8a492e8d2c35210ac673729d92c58d595a13b484;hb=0007de6d40db139c025a8b2cba9ef04ee4837608;hp=236a8742630d778422cfc7735149ef513a2767e6;hpb=9363a476231afbb15fe9023ed82c3cf5f896c8e8;p=gnus diff --git a/lisp/gnus-sync.el b/lisp/gnus-sync.el index 236a87426..8a492e8d2 100644 --- a/lisp/gnus-sync.el +++ b/lisp/gnus-sync.el @@ -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 ;; Keywords: news synchronization nntp nnrss @@ -25,6 +24,10 @@ ;; This is the gnus-sync.el package. +;; It's due for a rewrite using gnus-after-set-mark-hook and +;; gnus-before-update-mark-hook. Until then please consider it +;; experimental. + ;; Put this in your startup file (~/.gnus.el for instance) ;; possibilities for gnus-sync-backend: @@ -32,23 +35,28 @@ ;; 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: ;; - after gnus-sync-read, the message counts are wrong +;; - use gnus-after-set-mark-hook and gnus-before-update-mark-hook to +;; catch the mark updates + ;;; Code: (eval-when-compile (require 'cl)) +(require 'gnus) +(require 'gnus-start) (require 'gnus-util) (defgroup gnus-sync nil "The Gnus synchronization facility." - :version "23.1" + :version "24.1" :group 'gnus) (defcustom gnus-sync-newsrc-groups `("nntp" "nnrss") @@ -96,6 +104,7 @@ 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 + ;; TODO: keep the old contents for groups we don't have! (let ((gnus-sync-newsrc-loader (loop for entry in (cdr gnus-newsrc-alist) when (gnus-grep-in-list @@ -105,7 +114,6 @@ synchronized, I believe). Also see `gnus-variable-list'." (mapcar (lambda (offset) (cons offset (nth offset entry))) gnus-sync-newsrc-offsets))))) - (with-temp-file gnus-sync-backend (progn (let ((coding-system-for-write gnus-ding-file-coding-system) @@ -125,13 +133,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 +201,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 @@ -211,7 +221,7 @@ synchronized, I believe). Also see `gnus-variable-list'." (interactive) ;; (add-hook 'gnus-get-new-news-hook 'gnus-sync-read) (add-hook 'gnus-save-newsrc-hook 'gnus-sync-save) - (add-hook 'gnus-read-newsrc-el-hoo4a 'gnus-sync-read)) + (add-hook 'gnus-read-newsrc-el-hook 'gnus-sync-read)) (defun gnus-sync-unload-hook () "Uninstall the sync hooks."