Gnus development mailing list
 help / color / mirror / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Concerning marks and the back end.
Date: Sat, 04 Jan 2003 13:23:53 -0500	[thread overview]
Message-ID: <8665t4bwp2.fsf@asfast.com> (raw)
In-Reply-To: <8665t6de1c.fsf@asfast.com>

Lloyd Zusman <ljz@asfast.com> writes:

> Simon Josefsson <jas@extundo.com> writes:
>>
>> [ ... ]
>>
>> You can set the display parameter to an array of predicates, e.g.:
>>
>> [or unread (and no-unreads my-article-old-p)]
>>
>>      (defun my-article-old-p ()
>>        "Say whether an article is old."
>>        (< (time-to-days (date-to-time (mail-header-date gnus-headers)))
>>           (- (time-to-days (current-time)) gnus-agent-expire-days)))
>>
>> implementing the no-unreads function is left as an exercise. :-)
>>
>> But this might not work either, as I think display predicates was
>> implemented as limiting, so you will fetch all article headers anyway.
>
> Hmmm ... well, I could always cheat and use `defadvice' to wrap the
> function which enters the group; [ ... ]
>
> Sounds easy, anyway. :)

... and indeed it turned out to be straightforward.  The defadvice'd
function is below.  Yes, I know it's an ugly hack, and I'm still hoping
for a better way to do this.  But at least this works in the mean time.


>> But I still wonder why entering the group is slow for you.  I have
>> 15,000 messages in my ding mailing list mailbox, which is stored on a
>> IMAP server, and entering it and viewing the unread and ticked
>> articles takes no time.  When I get several hundred thousand articles
>> it becomes a little slow though (long coffe break).
>
> Well, I still will do the profiling that you suggested earlier.

... and I'll do this profiling soon.

Here's the function.  I could have used fewer variable definition steps
in the 'let' clause, but I broke it into more pieces for ease of
debugging during development.


 (defvar ljz-group-default-display-count 256
   "*Default count of articles to display when entering a group, if there
 are no unread, dormant, or ticked articles, and if there is no prefix
 argument.")

 (defadvice gnus-group-read-group (around gnus-group-read-group freeze)
   (interactive "P")
   (let* ((the-group (or group (gnus-group-group-name)))
	  (the-unread-count (gnus-group-unread the-group))
	  (the-marks (gnus-info-marks (gnus-get-info the-group)))
	  (the-dormant (cdr (assq 'dormant the-marks)))
	  (the-ticked (cdr (assq 'tick the-marks)))
	  (the-count
	   (+ the-unread-count (length the-dormant) (length the-ticked)))
	  (the-parameter (if all all (if (> the-count 0)
					 nil
				       ljz-group-default-display-count))))
     (ad-set-arg 0 the-parameter)
     ad-do-it))


-- 
 Lloyd Zusman
 ljz@asfast.com



  parent reply	other threads:[~2003-01-04 18:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-01 22:23 Lloyd Zusman
2003-01-02 16:57 ` Kai Großjohann
2003-01-02 18:23   ` Lloyd Zusman
2003-01-02 18:46     ` Lars Magne Ingebrigtsen
2003-01-03  2:23       ` Lloyd Zusman
2003-01-03  2:45         ` Simon Josefsson
2003-01-03  2:56           ` Lloyd Zusman
2003-01-03  3:01             ` Lloyd Zusman
2003-01-03  4:11               ` Simon Josefsson
2003-01-03  4:59                 ` Lloyd Zusman
2003-01-03 14:57                   ` Simon Josefsson
2003-01-04 18:23                   ` Lloyd Zusman [this message]
2003-01-13 18:47                     ` A solution that's better than my ugly hack? Lloyd Zusman
2003-01-13 18:53                       ` Lars Magne Ingebrigtsen
2003-01-13 19:00                         ` Lloyd Zusman
2003-01-13 19:18                           ` Lars Magne Ingebrigtsen
2003-01-13 19:26                             ` Lloyd Zusman
2003-01-13 19:30                               ` Lars Magne Ingebrigtsen
2003-01-13 19:33                                 ` Lloyd Zusman
2003-01-13 21:04                                 ` Lloyd Zusman
2003-01-13 19:32                               ` Lloyd Zusman
2003-01-03 17:54         ` Concerning marks and the back end Kai Großjohann
2003-01-03 18:20           ` Lloyd Zusman
2003-01-03 17:53     ` Kai Großjohann
2003-01-03 18:15       ` Lloyd Zusman
2003-01-03 19:18         ` Kai Großjohann
2003-01-03 19:34           ` Lloyd Zusman
2003-01-03 19:43             ` Lloyd Zusman
2003-01-03 21:03               ` Kai Großjohann
2003-01-03 21:24                 ` Lloyd Zusman
2003-01-04 14:52                   ` Kai Großjohann
2003-01-04 16:19                     ` Lloyd Zusman
2003-01-03 20:17             ` Lars Magne Ingebrigtsen
2003-01-03 20:41               ` Lloyd Zusman
2003-01-03 20:45                 ` Lars Magne Ingebrigtsen
2003-01-03 20:52                   ` Lloyd Zusman
2003-01-03 21:05                     ` Kai Großjohann
2003-01-03 21:05                 ` Kai Großjohann
2003-01-04  4:50                   ` Lloyd Zusman
2003-01-03 20:53             ` Paul Jarc
2003-01-03 20:58               ` Lloyd Zusman
2003-01-03 21:02             ` Kai Großjohann
2003-01-02 19:14 ` Simon Josefsson
2003-01-03  2:25   ` Lloyd Zusman

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=8665t4bwp2.fsf@asfast.com \
    --to=ljz@asfast.com \
    /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).