From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/22629 Path: main.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= Newsgroups: gmane.emacs.gnus.general Subject: Re: Groups which have new mails Date: 19 Apr 1999 18:15:47 -0400 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1035160514 30344 80.91.224.250 (21 Oct 2002 00:35:14 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 00:35:14 +0000 (UTC) Cc: ding@gnus.org Return-Path: Original-Received: from farabi.math.uh.edu (farabi.math.uh.edu [129.7.128.57]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id SAA10705 for ; Mon, 19 Apr 1999 18:18:39 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by farabi.math.uh.edu (8.9.1/8.9.1) with ESMTP id RAB13632; Mon, 19 Apr 1999 17:17:34 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 19 Apr 1999 17:17:56 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id RAA16792 for ; Mon, 19 Apr 1999 17:17:45 -0500 (CDT) Original-Received: from jupiter.rtsq.qc.ca (rtsq.grics.qc.ca [199.84.132.81]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id SAA10673 for ; Mon, 19 Apr 1999 18:17:37 -0400 (EDT) Original-Received: from ariel.progiciels-bpi.ca by jupiter.rtsq.qc.ca (8.8.8/8.8.8) with SMTP id SAA26717; Mon, 19 Apr 1999 18:16:29 -0400 Original-Received: from iro.umontreal.ca (uucp@localhost) by ariel.progiciels-bpi.ca (950413.SGI.8.6.12/950213.SGI) via UUCP id SAA21952; Mon, 19 Apr 1999 18:18:56 -0700 Original-Received: from titan.progiciels-bpi.ca.progiciels-bpi.ca by icule.progiciels-bpi.ca (8.8.8/8.8.8) with ESMTP id SAA02847; Mon, 19 Apr 1999 18:15:57 -0400 Original-To: Danny Siu X-Face: "b_m|CE6#'Q8fliQrwHl9K,]PA_o'*S~Dva{~b1n*)K*A(BIwQW.:LY?t4~xhYka_.LV?Qq `}X|71X0ea&H]9Dsk!`kxBXlG;q$mLfv_vtaHK_rHFKu]4'<*LWCyUe@ZcI6"*wB5M@[m writes: > WIBNI one could list only the groups which has new mails? This makes > mail reading much easier if you have tons of mail groups. I set my > gnus-group-line-format to indicate whether a group has new articles (%m) > but can't find a handy way ('A anything') of just showing them and hiding > the rest. I have tricks for achieving something similar. Here there are. The cleanup has been done a bit hastily, I have to go in a few minutes, and hope I did not forget things (tell me). I wrote this for me alone, adjustments might be needed for you, I do not guarantee that it works as presented. Usage is simple. `l' in the group buffer forces the display of groups having messages in them, even if within some hidden topic. `%' from the group buffer enters a group with unread messages (and then, the group will not be entered a second time before even newer messages get in). `%' from the summary buffer directly switches into another group having messages in it, that is, it jumps from summary to summary. This is not exactly what you want, because groups do not get hidden. But seeing `%' as a mark for new messages, and using `%' as a command both in the group and the summary buffer, for scanning all messages, looks consistent to me :-). This is not part of what follows, but I also sort the threads by descending date, so new messages tend to appear near the top of the summary. All this helps me to be quicker at checking for new mail after splitting occurred. (defvar fp-gnus-call-when-no-new-mail nil "If non-nil, function to call when new mail is wanted and there is none. Only used by `fp-gnus-group-next-group-with-new-mail'.") (defun fp-unhide-groups-with-new-mail () (save-excursion (let ((history nnmail-split-history) groups) (while history (let ((assocs (pop history))) (while assocs (unless (member (caar assocs) groups) (push (caar assocs) groups)) (setq assocs (cdr assocs))))) (while groups (gnus-group-jump-to-group (car groups)) (pop groups))))) (add-hook 'gnus-group-prepared-hook 'fp-unhide-groups-with-new-mail) (defun fp-gnus-group-list-groups () (interactive) (gnus-group-list-groups) (fp-unhide-groups-with-new-mail)) (defun fp-gnus-summary-next-group-with-new-mail () "Directly enter the next newsgroup having new mail in it. Wrap around to the beginning of the group buffer as necessary. Merely exits the summary buffer if no such mailgroup exists." (interactive) (gnus-summary-exit) (fp-gnus-group-next-group-with-new-mail)) (defun fp-gnus-group-next-group-with-new-mail () "Merge any new mail, and enter the next newsgroup having new mail in it. Wrap around to the beginning of the group buffer as necessary. Do not move the cursor if no such mailgroup exists. Return nil if no new mail anymore." (interactive) (let ((here (point)) wrapped found) (let ((spool (or (getenv "MAIL") (concat rmail-spool-directory (user-login-name))))) (switch-to-buffer gnus-group-buffer) (when (and (file-readable-p spool) (> (nth 7 (file-attributes (file-chase-links spool))) 0)) (gnus-group-get-new-news))) (fp-unhide-groups-with-new-mail) ;; FIXME! (while (cond ((nnmail-new-mail-p (gnus-group-group-name)) (gnus-group-read-group) (setq found t) nil) ((gnus-group-search-forward)) (wrapped (goto-char here) (if fp-gnus-call-when-no-new-mail (apply fp-gnus-call-when-no-new-mail nil) (gnus-message 7 "No more new mail")) nil) (t (beginning-of-buffer) (setq wrapped t))) nil) found)) (defun fp-gnus-group-get-new-news (&optional arg) (interactive "P") (gnus-group-get-new-news arg) (fp-gnus-group-next-group-with-new-mail)) (eval-after-load "gnus-group" '(gnus-define-keys gnus-group-mode-map "%" fp-gnus-group-next-group-with-new-mail "g" fp-gnus-group-get-new-news "l" fp-gnus-group-list-groups)) (defun fp-gnus-summary-next-group-with-new-mail () "Directly enter the next newsgroup having new mail in it. Wrap around to the beginning of the group buffer as necessary. Merely exits the summary buffer if no such mailgroup exists." (interactive) (gnus-summary-exit) (fp-gnus-group-next-group-with-new-mail)) (eval-after-load "gnus-sum" '(gnus-define-keys gnus-summary-mode-map "%" fp-gnus-summary-next-group-with-new-mail)) -- François Pinard mailto:pinard@iro.umontreal.ca Join the free Translation Project! http://www.iro.umontreal.ca/~pinard