Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: info-gnus-english@gnu.org
Subject: Re: Gnus state, feed commands
Date: Mon, 18 Nov 2013 00:57:48 +0100	[thread overview]
Message-ID: <8761rq4m3u.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: <87ppq0yuza.fsf@nl106-137-194.student.uu.se>

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	other threads:[~2013-11-17 23:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-16 18:17 Emanuel Berg
2013-11-16 19:31 ` W. Greenhouse
     [not found] ` <mailman.6381.1384630484.10748.info-gnus-english@gnu.org>
2013-11-16 20:03   ` Emanuel Berg
2013-11-17 23:57     ` Emanuel Berg [this message]
2013-11-20 23:00       ` W. Greenhouse
     [not found]       ` <mailman.6725.1384988464.10748.info-gnus-english@gnu.org>
2013-11-21 22:54         ` Emanuel Berg

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=8761rq4m3u.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=info-gnus-english@gnu.org \
    /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).