Gnus development mailing list
 help / color / mirror / Atom feed
From: Andrew Cohen <cohen@bu.edu>
To: ding@gnus.org
Subject: mangled marks and nnselect
Date: Sat, 06 May 2017 21:59:41 +0800	[thread overview]
Message-ID: <87inleozle.fsf@hanan> (raw)


For anyone who has been testing the feature/gnus-nnselect branch
(probably this means only Eric:))

I have spent the evening tracking down an unfortunate bug in storing
marks in originating groups when exiting from an nnselect group. I made
two errors in the code that resulted in some harmless but annoying cruft
entering the .newsrc.eld file:

1. I was putting article numbers in the 'seen list
   that weren't part of the actual group (that is, the seen list was
   correct but had extra numbers that didn't correspond to any real
   articles). This is harmless (as far as I can tell---its been
   happening to me for quite awhile with no ill effects) but
   annoying. I've fixed it now, but removing the extraneous info has to
   be done 'by hand' (and by that I mean it can be done in lisp, but it
   won't happen automatically with continued use of gnus).

2. I wasn't properly compressing the 'unexist list. Again this is
   totally harmless except that the uncompressed lists can take up a
   significant amount of disk space if you have groups with large
   numbers of article numbers in play (which is the case if you have
   been using an imap group for many years, for example). My .newsrc.eld
   decreased in size by a factor of 2 (from 2 MB to 1 MB). Again this
   won't fix itself, but can be fixed with a bit of lisp.


Here is what I used to fix it.

1. Make a back-up copy of .newsrc.eld

2. Make sure that gnus is running (so that the .newsrc.eld is loaded by
   gnus).

3. Execute the following code for each server that might be screwed up
   (replace server with the name of the server, e.g. "nnimap:foo")

4. Quit from gnus.

5. Check that this didn't destroy your .newsrc.eld. If it did, put the
   copy into place to restore all the marks.

;; make a list of groups on the server
(setq my-groups (nnir-get-srv server))


;; compress unexist 
(dolist (group my-groups)
  (let* ((marks (gnus-info-marks (gnus-get-info group)))
   	 (unexist (gnus-uncompress-sequence (alist-get 'unexist marks))))
    (when (and marks unexist)
      (setf (cdr (assoc 'unexist marks)) (gnus-compress-sequence unexist)))))

;; remove extraneous articles from seen list
(dolist (group my-groups)
  (let* ((marks (gnus-info-marks (gnus-get-info group)))
	 (seen  (gnus-uncompress-sequence (alist-get 'seen marks)))
	 (active (cdr (gnus-active group))))
    (when (and active seen (> (car-safe (last seen)) active))
    (let (my-list)
    (cl-every #'(lambda (num)
    (and  (>= active num) (push num my-list))) seen)
    (setf (cdr (assoc 'seen marks)) 
       (gnus-compress-sequence (nreverse my-list)))))))




             reply	other threads:[~2017-05-06 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 13:59 Andrew Cohen [this message]
2017-05-07  3:13 ` Eric Abrahamsen

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=87inleozle.fsf@hanan \
    --to=cohen@bu.edu \
    --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).