From: Matt Armstrong <matt@lickey.com>
Subject: Hiding groups with unread messages
Date: Mon, 06 May 2002 13:35:30 -0600 [thread overview]
Message-ID: <87d6w9ysql.fsf@squeaker.lickey.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]
In my opinion, Gnus is the #1 mail reader when it comes to dealing
with a lot of incoming mail. You've got topics, group levels,
scoring, adaptive scoring, etc. all working for you.
But Gnus can't do this:
- Don't show a group until there has been enough recent traffic on
the list to make it worth my time to look at it.
- Show the group anyway if it has been long time since I read it,
regardless of how many unread messages it contains.
I have no self control, so I *need* gnus to hide high volume mailing
lists from me until there is a big chunk of mail to read in one go.
The other gnus mechanisms for this (group levels, topics) are manual
operations and only approximate what I want Gnus to do for me.
So I went and implemented the idea by adding a hide-unread and
hide-unread-timeout group parameters. The flat and topic mode group
buffer creation functions consult these parameters when deciding
whether to list the group. A variable gnus-group-hide-unread-timeout
is the default value for the hide-unread-timeout parameter.
Attached is the patch. I'd appreciate any comments or review folks
have as I'm a beginner at elisp. If folks are positive, I'll do some
.texi docs and submit a final patch for CVS.
--
Don't send mail to Jan.Welch@hole.lickey.com
The address is there for spammers to harvest.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hide-unread.patch --]
[-- Type: text/x-patch, Size: 6061 bytes --]
Index: gnus-group.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-group.el,v
retrieving revision 6.73
diff -u -r6.73 gnus-group.el
--- gnus-group.el 2002/04/23 01:18:09 6.73
+++ gnus-group.el 2002/05/06 19:42:31
@@ -112,6 +112,29 @@
:group 'gnus-group-levels
:type 'boolean)
+(defcustom gnus-group-hide-unread-timeout 86400
+ "*Ignore a group's hide-unread parameter after this many seconds.
+The `hide-unread' group parameter can cause a group to not be listed
+in the group buffer if it doesn't have enough unread messages. In low
+volume groups, it makes sense to show the group anyway if you haven't
+read it in a while.
+
+First, you must add `gnus-group-set-timestamp' to your
+`gnus-select-group-hook'. Otherwise, Gnus doesn't know how long it
+has been since you last read a group.
+
+Second, set this variable to the number of seconds you want to wait
+before hide-unread has no effect.
+
+Note, you can also set the `hide-unread-timeout' parameter on each
+group individually -- this variable merely provides a default if
+`hide-unread-timeout' is not set on a group."
+ :group 'gnus-group-listing
+ :type '(radio (const :tag "No timeout" nil)
+ (const :tag "One hour" 3600)
+ (const :tag "One day" 86400)
+ (integer :tag "Seconds")))
+
(defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
"*Function used for sorting the group buffer.
This function will be called with group info entries as the arguments
@@ -1130,6 +1153,30 @@
(not test)
test))))))
+(defun gnus-group-hide-unread-timeout (group)
+ "Find the hide-unread timeout for GROUP."
+ (let ((timeout (or (gnus-group-find-parameter group 'hide-unread-timeout)
+ gnus-group-hide-unread-timeout)))
+ (if (numberp timeout)
+ timeout
+ nil)))
+
+(defun gnus-group-unread-threshold (group)
+ "Find the unread threshold for GROUP.
+Any groups with fewer than this many unread articles won't be listed
+in the group buffer (at least, simply because they have unread
+articles). This function will normally return 0 unless the
+`hide-unread' parameter is set on GROUP."
+ (let ((hide-unread (gnus-group-find-parameter group 'hide-unread))
+ timeout)
+ (if (numberp hide-unread)
+ (if (and (numberp (setq timeout (gnus-group-hide-unread-timeout
+ group)))
+ (< timeout (gnus-group-timestamp-delta group)))
+ 0
+ hide-unread)
+ 0)))
+
(defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
"List all newsgroups with unread articles of level LEVEL or lower.
If PREDICATE is a function, list groups that the function returns non-nil;
@@ -1173,7 +1220,7 @@
(if (eq unread t) ; Unactivated?
gnus-group-list-inactive-groups
; We list unactivated
- (> unread 0))
+ (> unread (gnus-group-unread-threshold group)))
; We list groups with unread articles
(and gnus-list-groups-with-ticked-articles
(cdr (assq 'tick (gnus-info-marks info))))
Index: gnus-topic.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-topic.el,v
retrieving revision 6.26
diff -u -r6.26 gnus-topic.el
--- gnus-topic.el 2002/05/06 16:52:06 6.26
+++ gnus-topic.el 2002/05/06 19:42:34
@@ -228,7 +228,7 @@
(if (or (eq unread t)
(eq unread nil))
gnus-group-list-inactive-groups
- (> unread 0))
+ (> unread (gnus-group-unread-threshold group)))
(and gnus-list-groups-with-ticked-articles
(cdr (assq 'tick (gnus-info-marks info))))
;; Has right readedness.
Index: nnmaildir.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmaildir.el,v
retrieving revision 6.17
diff -u -r6.17 nnmaildir.el
--- nnmaildir.el 2002/04/22 02:28:17 6.17
+++ nnmaildir.el 2002/05/06 19:42:38
@@ -134,6 +134,7 @@
(error nil :type string) ;; last error message, or nil
(mtime nil :type list) ;; modtime of dir
(gnm nil) ;; flag: split from mail-sources?
+ (courier nil) ;; flag: create maildirs w/ leading '.'
(create-dir nil :type string)) ;; group creation directory
(defmacro nnmaildir--nlist-last-num (nlist)
@@ -541,6 +542,10 @@
(car x)
(setf (nnmaildir--srv-gnm server) t)
(require 'nnmail))
+ (and (setq x (assq 'courier-compatible defs))
+ (setq x (cdr x))
+ (car x)
+ (setf (nnmaildir--srv-courier server) t))
(setq x (assq 'create-directory defs))
(when x
(setq x (cadr x)
@@ -897,7 +902,7 @@
(nnmaildir--prepare server nil)
(catch 'return
(let ((create-dir (nnmaildir--srv-create-dir nnmaildir--cur-server))
- srv-dir dir groups)
+ srv-dir dir groups maildir)
(when (zerop (length gname))
(setf (nnmaildir--srv-error nnmaildir--cur-server)
"Invalid (empty) group name")
@@ -922,13 +927,21 @@
(setq dir srv-dir
dir (file-truename dir)
dir (concat dir create-dir)))
- (setq dir (nnmaildir--subdir (file-name-as-directory dir) gname))
+ (setq dir (file-name-as-directory dir))
+ (setq maildir (concat dir
+ (if (nnmaildir--srv-courier nnmaildir--cur-server)
+ (concat "." gname)
+ gname)))
+ (when (equal (file-name-as-directory maildir) (nnmaildir--nndir dir))
+ (setf (nnmaildir--srv-error nnmaildir--cur-server)
+ (concat "Group name may not be " gname))
+ (throw 'return nil))
+ (setq dir (file-name-as-directory maildir))
(nnmaildir--mkdir dir)
(nnmaildir--mkdir (nnmaildir--tmp dir))
(nnmaildir--mkdir (nnmaildir--new dir))
(nnmaildir--mkdir (nnmaildir--cur dir))
- (setq create-dir (file-name-as-directory create-dir))
- (make-symbolic-link (concat create-dir gname) (concat srv-dir gname))
+ (make-symbolic-link maildir (concat srv-dir gname))
(nnmaildir-request-scan 'find-new-groups))))
(defun nnmaildir-request-rename-group (gname new-name &optional server)
next reply other threads:[~2002-05-06 19:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-06 19:35 Matt Armstrong [this message]
2002-05-07 8:31 ` Kai Großjohann
2002-05-07 16:07 ` Matt Armstrong
2002-05-08 17:00 ` Kai Großjohann
2002-05-08 19:36 ` Matt Armstrong
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=87d6w9ysql.fsf@squeaker.lickey.com \
--to=matt@lickey.com \
/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).