From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/47172 Path: main.gmane.org!not-for-mail From: Joakim Hove Newsgroups: gmane.emacs.gnus.general Subject: New mail in modeline Date: 14 Oct 2002 14:05:49 +0200 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1034597157 29142 127.0.0.1 (14 Oct 2002 12:05:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 14 Oct 2002 12:05:57 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1813yt-0007Zm-00 for ; Mon, 14 Oct 2002 14:05:55 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1813z9-0007P1-00; Mon, 14 Oct 2002 07:06:11 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 14 Oct 2002 07:06:53 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id HAA29151 for ; Mon, 14 Oct 2002 07:06:41 -0500 (CDT) Original-Received: (qmail 24607 invoked by alias); 14 Oct 2002 12:07:34 -0000 Original-Received: (qmail 24592 invoked from network); 14 Oct 2002 12:07:32 -0000 Original-Received: from solan.itea.ntnu.no (129.241.190.100) by gnus.org with SMTP; 14 Oct 2002 12:07:32 -0000 Original-Received: from metropolis.phys.ntnu.no.phys.ntnu.nu (metropolis.phys.ntnu.no [129.241.48.32]) by solan.itea.ntnu.no (8.12.1/8.12.1) with ESMTP id g9EC5nVL029782 for ; Mon, 14 Oct 2002 14:05:50 +0200 (MET DST) Original-To: ding@gnus.org Original-Lines: 36 User-Agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.2 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:47172 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:47172 --=-=-= Hello, below is a small lisp "packet" I have written which displays the number of new messages various mail groups in the general emacs modeline: [INBOX:2 hotmail:25] For example means that there are two unread messages in my INBOX group, and 25 in my hotmail group. This is particularly interesting for hotmail (i.e. probably spam) groups which I have at a subscription level of 6, and then only check with long intervals, without evering cluttering the *Group* buffer with these mails/groups. It should be to just load the file, and then fire gnus, or you could add a (require 'gnus-modeline) in your ~/.gnus. Comments appreciated :-) Joakim Hove --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=gnus-modeline.el (add-hook 'gnus-exit-gnus-hook 'close-newmail-modeline) (add-hook 'gnus-exit-gnus-hook 'gnus-delete-incoming-files) (add-hook 'gnus-startup-hook 'gnus-delete-incoming-files) (add-hook 'gnus-startup-hook 'init-newmail-modeline) (add-hook 'gnus-after-getting-new-news-hook 'make-newmail-modeline) (add-hook 'gnus-started-hook 'make-newmail-modeline) (add-hook 'gnus-summary-exit-hook 'make-newmail-modeline) (defun close-newmail-modeline () (setq global-mode-string "[Gnus not running ...]") (force-mode-line-update) ) (defun init-newmail-modeline () (setq persistent-newmail-count 0) ) (defvar watch-mailgroups-list '(("nnml:mail.fysikk" "fysikk") ("nnml:mail.INBOX" "INBOX") ("nnml:mail.asle" "asle") ("nnml:mail.ntnu" "ntnu") ("nnml:mail.hove" "hove") ("nnml:mail.com" "com") ("nnml:mail.hotmail" "hotmail") ("nnml:mail.stud" "stud")) "This is the list of (mail)groups watched by the function \"make-newmail-modeline\". Every element in the list is a two element list, where the first element is the fully qualified group name used to query gnus for the number of unread messages, and the last is the name displayed in the modeline together with the number of new messages. Example: ======== (setq watch-mailgroups-list '((\"nnml:mail.somelist\" \"list\") (\"nnml:mail.private\" \"private\"))) Will check the mailgroups \"nnml:mail.somelist\" and \"nnml:mail.privat\", and the modeline will be displayed as: \"[list:2 private:3]\" if there are two and three unread messages in the two groups respectively.") (defun make-newmail-modeline () "This function scans through all the (mail)groups in the list \"watch-mailgroup-list\" and queries gnus how many unread messages there are in each group. From this the global emacs string \"global-mode-string\" is built up, and the number of unread messages is displayed on the mode line. It is intended to be used together with a \"gnus-demon\" which fetches new mail periodically. To work as intended it should be run as a hook: (add-hook 'gnus-after-getting-new-news-hook 'make-newmail-modeline) (add-hook 'gnus-started-hook 'make-newmail-modeline) (add-hook 'gnus-summary-exit-hook 'make-newmail-modeline) It breaks the built emacs function \"display-time\" which will use \"global-mode-string\" to display the time. If you have any suggestions to improvements I would be happy to hear from you: hove@phys.ntnu.no Joakim Hove" (interactive) (setq global-mode-string "[") (let ((total-new-mail 0)) (let ((index 0)) (while (< index (length watch-mailgroups-list)) (let ((thegroup (nth index watch-mailgroups-list))) (let ((group (nth 0 thegroup)) (group-name (nth 1 thegroup))) (let* ((int-count (gnus-group-unread group)) (string-count (number-to-string int-count))) (if (> int-count 0) (setq global-mode-string (concat global-mode-string group-name ":" string-count " ")) ) (setq total-new-mail (+ total-new-mail int-count)) ) ) ) (setq index (+ index 1)) ) ) (if (equal total-new-mail 0) (setq global-mode-string "[No new mail]") (progn (setq global-mode-string (substring global-mode-string 0 -1)) (setq global-mode-string (concat global-mode-string "]"))) ) (if (> total-new-mail persistent-newmail-count) (ding)) (setq persistent-newmail-count total-new-mail) ) (force-mode-line-update) ) (provide 'gnus-modeline) --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit -- ==== Joakim Hove www.phys.ntnu.no/~hove/ ======================= || Institutt for fysikk (735) 93637 / E3-141 | Skøyensgate 10D || || N - 7491 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim || ================================================= 73 93 31 68 ========= --=-=-=--