help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Gnus state, feed commands


From: Emanuel Berg
Subject: Re: Gnus state, feed commands
Date: Mon, 18 Nov 2013 00:56:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> That number above comes from the function
>> gnus-group-unread, so you could probably map all
>> subscribed groups through it and collect the unread
>> count. I've never messed with the mode line, so I'm
>> not sure about using a function to produce a value
>> for it...
>
> Yes, I was told on gnu.emacs.gnus that I was possible
> to do like this:
>
> (gnus-number-of-unseen-articles-in-group "gnu.emacs.help")

I "sort of" solved this. Check out the comments.

(defvar *unread-mails*)
(setq *unread-mails* "")
(defun update-unread-mails ()
  (let ((num-msgs (gnus-number-of-unseen-articles-in-group "alt.test")))
    (setq *unread-mails*
          (if (< 0 num-msgs) "* MAIL *" "") )))
;; I found it to be much better not to use the number.
;; Then you stare at that digit - could be 0, could be
;; 7, could it be... Zzz...  until you get dizzy. The
;; idea was to have the computer tell you about mails,
;; not have *you* stare into a digit.

(defun gnus-get-news-bg ()
  (interactive)
  (let ((ori-buffer (current-buffer)))
    (gnus-start-or-show) ; basically (gnus)
    (switch-to-buffer ori-buffer) )) ; can this be avoided?

(defun gnus-after-init ()
  (gnus-demon-add-handler 'gnus-get-news-bg 1 t)
  (gnus-demon-init) )
(add-hook 'gnus-started-hook 'gnus-after-init)
(add-hook 'gnus-get-new-news-hook        'update-unread-mails)
(add-hook 'gnus-agent-fetched-hook       'update-unread-mails)
(add-hook 'gnus-group-catchup-group-hook 'update-unread-mails)
;; One would think, there should be just one hook, to
;; reflect the change of state of the set of groups
;; *and* their unseen articles.

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


reply via email to

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