Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* How to get all unread news numbers of gnus?
@ 2008-09-29 12:45 Andy Stewart
  2008-10-01 16:14 ` Andy Stewart
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Stewart @ 2008-09-29 12:45 UTC (permalink / raw)
  To: info-gnus-english

Hi, everyone!

I want to write a function that notify gnus coming news.
And display unread news number in mode-line.

But I don't know how to get the numbers of all unread news after execute
command 'gnus-group-get-new-news'.

This have a command or variable that can do this?

Thanks for your help!

Regards.

Andy.

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

* Re: How to get all unread news numbers of gnus?
  2008-09-29 12:45 How to get all unread news numbers of gnus? Andy Stewart
@ 2008-10-01 16:14 ` Andy Stewart
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Stewart @ 2008-10-01 16:14 UTC (permalink / raw)
  To: info-gnus-english

Andy Stewart <lazycat.manatee@gmail.com> writes:

> Hi, everyone!
>
> I want to write a function that notify gnus coming news.
> And display unread news number in mode-line.
>
> But I don't know how to get the numbers of all unread news after execute
> command 'gnus-group-get-new-news'.
>
> This have a command or variable that can do this?
>
> Thanks for your help!
>
> Regards.
>
> Andy.


Answer myself question:


(defun gnus-get-unread-news-number ()
  "Get the total number of unread news of gnus group."
  (let (total-unread-news-number)
    (setq total-unread-news-number 0)
    (mapc '(lambda (g)
             (let* ((group (car g))
                    (unread (gnus-group-unread group)))
               (when (and (numberp unread)
                          (> unread 0))
                 (setq total-unread-news-number (+ total-unread-news-number unread)))))
          gnus-newsrc-alist)
    total-unread-news-number))

Enjoy!

   -- Andy.

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

end of thread, other threads:[~2008-10-01 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-29 12:45 How to get all unread news numbers of gnus? Andy Stewart
2008-10-01 16:14 ` Andy Stewart

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