Gnus development mailing list
 help / color / mirror / Atom feed
From: "François Pinard" <pinard@iro.umontreal.ca>
Cc: ding@gnus.org
Subject: Re: Groups which have new mails
Date: 19 Apr 1999 18:15:47 -0400	[thread overview]
Message-ID: <oqhfqcp88c.fsf@titan.progiciels-bpi.ca> (raw)
In-Reply-To: Danny Siu's message of "19 Apr 1999 14:43:45 -0700"

Danny Siu <dsiu@Adobe.COM> 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



  reply	other threads:[~1999-04-19 22:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-19 21:43 Danny Siu
1999-04-19 22:15 ` François Pinard [this message]
1999-04-19 22:40 ` Justin Sheehy
1999-04-20  1:10   ` Danny Siu
1999-04-20  9:25     ` Kai.Grossjohann
1999-04-20 14:56     ` Justin Sheehy
1999-04-20 19:26       ` Danny Siu
1999-04-20 20:35     ` Matt Armstrong
1999-04-20  9:27       ` Kai.Grossjohann

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=oqhfqcp88c.fsf@titan.progiciels-bpi.ca \
    --to=pinard@iro.umontreal.ca \
    --cc=ding@gnus.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).