info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get all unread news numbers of gnus?


From: Andy Stewart
Subject: Re: How to get all unread news numbers of gnus?
Date: Thu, 02 Oct 2008 00:14:41 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]