Gnus development mailing list
 help / color / mirror / Atom feed
* mangled marks and nnselect
@ 2017-05-06 13:59 Andrew Cohen
  2017-05-07  3:13 ` Eric Abrahamsen
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cohen @ 2017-05-06 13:59 UTC (permalink / raw)
  To: ding


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)))))))




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mangled marks and nnselect
  2017-05-06 13:59 mangled marks and nnselect Andrew Cohen
@ 2017-05-07  3:13 ` Eric Abrahamsen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Abrahamsen @ 2017-05-07  3:13 UTC (permalink / raw)
  To: ding

Andrew Cohen <cohen@bu.edu> writes:

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

And, dutifully, here I am :)

[...]

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

Well, there was a diff, so I guess it did something, and nothing broke.
I will consider myself fixed!

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

--> nnir-get-active




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-07  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-06 13:59 mangled marks and nnselect Andrew Cohen
2017-05-07  3:13 ` Eric Abrahamsen

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).