Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: overriding marks for synchronization
Date: Fri, 13 Aug 2010 09:29:46 -0500	[thread overview]
Message-ID: <878w4aegbp.fsf@lifelogs.com> (raw)
In-Reply-To: <yb0d3tmmwiu.fsf@dod.no>

On Fri, 13 Aug 2010 16:12:41 +0200 Steinar Bang <sb@dod.no> wrote: 

>>>>>> Ted Zlatanov <tzz@lifelogs.com>:
>> Both changes were just comitted.  Test and let me know.

SB> Closer.  Firstly I seem to need to do a 
SB> (require 'gnus-sync)
SB> to actually load gnus-sync.  Is that expected? (ie. did I miss it from
SB> the documentatio?)  Is it forgotten from the documentation?  Or
SB> shouldn't it be neccessary?

It's necessary currently.  I'm not sure if it should be always on (since
it does nothing by default) or on request, that's why I didn't put it
in the docs.  What do you thikn?

SB> When I do that it saves the file.  But the file doesn't have any read
SB> marks.

SB> Here are the contents of the remote file saved over ssh:

SB> ;; -*- mode:emacs-lisp; coding: emacs-mule; -*-
SB> ;; Gnus sync data v. 0.0.1


SB> (setq gnus-newsrc-last-checked-date '"Fri, 13 Aug 2010 16:07:55 +0200")

For me, there's quite a bit in between:

(setq gnus-sync-newsrc-loader '(
... many lines omitted ...)

That's where the marks are stored.  You should see a message like
"gnus-sync: stored variables %s and %d groups in %s" in your messages.
It seems like gnus-sync-newsrc-loader is empty so that group count is
probably 0.  I think I see the problem; it didn't happen for me because
gnus-sync-newsrc-loader was already populated.  Try the following
fixed function (nunion should be on loader; also I added a "skipping
empty variable" comment):

(defun gnus-sync-save ()
"Save the Gnus sync data to the backend."
  (interactive)
  (cond
   ((stringp gnus-sync-backend)
    (gnus-message 7 "gnus-sync: saving to backend %s" gnus-sync-backend)
    ;; 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* ((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
          (let ((coding-system-for-write gnus-ding-file-coding-system)
                (standard-output (current-buffer)))
            (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
                           gnus-ding-file-coding-system))
            (princ ";; Gnus sync data v. 0.0.1\n")
            (let* ((print-quoted t)
                   (print-readably t)
                   (print-escape-multibyte nil)
                   (print-escape-nonascii t)
                   (print-length nil)
                   (print-level nil)
                   (print-circle nil)
                   (print-escape-newlines t)
                   (variables (cons 'gnus-sync-newsrc-loader
                                    gnus-sync-global-vars))
                   variable)
              (while variables
                (if (and (boundp (setq variable (pop variables)))
                           (symbol-value variable))
                    (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"
             gnus-sync-global-vars
             (length gnus-sync-newsrc-loader)
             gnus-sync-backend)

            ;; Idea from Dan Christensen <jdc@chow.mat.jhu.edu>
            ;; Save the .eld file with extra line breaks.
            (gnus-message 8 "gnus-sync: adding whitespace to %s"
                          gnus-sync-backend)
            (save-excursion
              (goto-char (point-min))
              (while (re-search-forward "^(\\|(\\\"" nil t)
                (replace-match "\n\\&" t))
              (goto-char (point-min))
              (while (re-search-forward " $" nil t)
                (replace-match "" t t))))))))
    ;; the pass-through case: gnus-sync-backend is not a known choice
    (nil)))




  reply	other threads:[~2010-08-13 14:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10 11:55 Ted Zlatanov
2010-08-11  3:18 ` Ted Zlatanov
2010-08-11  8:51 ` Steinar Bang
2010-08-11 13:36   ` Ted Zlatanov
2010-08-12 19:56     ` Ted Zlatanov
2010-08-13 12:26       ` Steinar Bang
2010-08-13 12:44         ` Steinar Bang
2010-08-13 12:52         ` Ted Zlatanov
2010-08-13 13:29           ` Ted Zlatanov
2010-08-13 14:12             ` Steinar Bang
2010-08-13 14:29               ` Ted Zlatanov [this message]
2010-08-13 18:41                 ` Steinar Bang
2010-08-13 19:39                 ` Steinar Bang
2010-08-13 19:58                   ` Ted Zlatanov
2010-08-14 13:38                     ` Steinar Bang
2010-08-14 14:55                       ` Ted Zlatanov
2010-08-15 11:18                         ` Steinar Bang
2010-08-18 13:44                           ` Ted Zlatanov
2010-08-30 15:59                             ` Steinar Bang
2010-08-30 16:06                               ` Steinar Bang
2010-08-31 18:52                                 ` Ted Zlatanov
2010-08-31 18:50                               ` Ted Zlatanov
2010-08-31 17:27                             ` Steinar Bang
2010-09-02  7:53                               ` Steinar Bang
2010-08-13 18:48           ` Steinar Bang
2010-08-13 19:47             ` Ted Zlatanov
2010-08-15 16:35 ` Didier Verna
2010-08-15 16:39   ` Steinar Bang
2010-08-15 17:20     ` Didier Verna
2010-08-17 18:55       ` Steinar Bang
2010-08-18 13:42         ` Ted Zlatanov
2010-08-22  8:21           ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w4aegbp.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).