* CODE: Hide groups with few unread articles
@ 2005-04-14 1:20 Mark Plaksin
2006-04-14 15:17 ` Lars Magne Ingebrigtsen
2006-04-14 18:13 ` Leon
0 siblings, 2 replies; 7+ messages in thread
From: Mark Plaksin @ 2005-04-14 1:20 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]
Here's some code that lets you hide groups when they have just a few unread
articles. You can set the threshold on a per-topic and/or per-group basis.
I use levels to separate my groups by priority but I am subscribed to a lot
of groups so each level contains a lot of groups. I'm easily distracted so
I wanted a way to hide groups without many unread articles. That way when
I check for new messages I don't end up reading two or three articles in
each of 25 groups. Instead I generally end up reading one or two groups
with 25 articles each.
It requires a small patch to gnus-group.el which allows you to specify the
predicate to use in the funcall to gnus-group-prepare-function. That's the
first attachment. The second attachment does the rest of the work.
You get a new group parameter called gnus-distraction-threshold. If a
group has fewer than gnus-distraction-threshold unread articles, it won't
be displayed. gnus-distraction-threshold defaults to 1 so nothing should
change unless you set the threshold somewhere. As with any group parameter
you can set it for a topic and have it apply to all groups in the topic.
By default groups with ticked articles are always displayed.
Two key bindings are turned on in the Group buffer:
- C-cd toggles distraction prevention on and off
- C-ct toggles the display of groups with ticked articles
I've only been playing with this for a few days so comments and suggestions
are very welcome!
[-- Attachment #2: gnus-group.el patch --]
[-- Type: text/plain, Size: 1232 bytes --]
--- gnus-group.el.orig 2005-04-13 20:43:59.300374438 -0400
+++ gnus-group.el 2005-04-13 20:54:52.185167853 -0400
@@ -255,6 +255,10 @@
:group 'gnus-group-listing
:type 'function)
+(defvar gnus-group-prepare-function-predicate '(lambda (info) (gnus-distraction-prevention-check info))
+ "Predicate to use in call to gnus-group-prepare-function.
+Defaults to '(lambda (info) (gnus-distraction-prevention-check info))")
+
(defcustom gnus-group-prepare-hook nil
"Hook called after the group buffer has been generated.
If you want to modify the group buffer, you can use this hook."
@@ -1156,9 +1160,12 @@
(props (text-properties-at (point-at-bol)))
(empty (= (point-min) (point-max)))
(group (gnus-group-group-name))
+ (unread-or-predicate (if (functionp gnus-group-prepare-function-predicate)
+ gnus-group-prepare-function-predicate
+ unread))
number)
(set-buffer gnus-group-buffer)
- (setq number (funcall gnus-group-prepare-function level unread lowest))
+ (setq number (funcall gnus-group-prepare-function level unread-or-predicate lowest))
(when (or (and (numberp number)
(zerop number))
(zerop (buffer-size)))
[-- Attachment #3: distraction-prevention.el --]
[-- Type: text/plain, Size: 2402 bytes --]
(defvar gnus-prevent-distraction-prevention nil
"If t, do not prevent distraction.")
(defvar gnus-distraction-prevention-include-ticked t
"If t, groups with ticked articles will always be displayed.")
(setq gnus-distraction-threshold 1)
(defun gnus-distraction-prevention-check (info)
"Return t if group has more than gnus-distraction-threshold unread articles.
If gnus-distraction-prevention-include-ticked is t, groups with ticked articles will always be displayed."
;(debug)
(let* ((group (car info))
(threshold (or
(if gnus-prevent-distraction-prevention
1
nil)
(gnus-group-find-parameter group
'gnus-distraction-threshold)
gnus-distraction-threshold))
(unread (or (gnus-group-unread group)
0))
(ticked (assoc 'tick (gnus-info-marks info))))
;; if unread is t, the group is not opened
(if (eq unread t)
(setq unread 0))
;;(message (concat "threshold for " group " is "
;; (number-to-string threshold)))
(or (and gnus-distraction-prevention-include-ticked
ticked)
(>= unread threshold))))
(defun gnus-distraction-prevention-toggle ()
"Toggle between distraction prevention and no distraction prevention."
(interactive)
(let ((message))
(if gnus-prevent-distraction-prevention
(progn
(setq gnus-prevent-distraction-prevention nil
message "on"))
(setq gnus-prevent-distraction-prevention t
message "off"))
(gnus-group-list-groups)
(message (concat "Distraction prevention is " message "."))))
(defun gnus-distraction-tick-toggle ()
"Toggle between displaying groups with ticked articles or not."
(interactive)
(let ((message))
(if gnus-distraction-prevention-include-ticked
(progn
(setq gnus-distraction-prevention-include-ticked nil
message "on"))
(setq gnus-distraction-prevention-include-ticked t
message "off"))
(gnus-group-list-groups)
(message (concat "Ticked distraction prevention is " message "."))))
(define-key gnus-group-mode-map (kbd "C-c d")
'gnus-distraction-prevention-toggle)
(define-key gnus-group-mode-map (kbd "C-c t")
'gnus-distraction-tick-toggle)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2005-04-14 1:20 CODE: Hide groups with few unread articles Mark Plaksin
@ 2006-04-14 15:17 ` Lars Magne Ingebrigtsen
2006-04-16 20:27 ` Mark Plaksin
2006-04-14 18:13 ` Leon
1 sibling, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2006-04-14 15:17 UTC (permalink / raw)
Cc: ding
Mark Plaksin <happy@usg.edu> writes:
> You get a new group parameter called gnus-distraction-threshold. If a
> group has fewer than gnus-distraction-threshold unread articles, it won't
> be displayed.
Interesting. This is something that I could well imagine using in a
couple of the topics I have.
Do you have copyright assignment papers on file with the FSF?
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2005-04-14 1:20 CODE: Hide groups with few unread articles Mark Plaksin
2006-04-14 15:17 ` Lars Magne Ingebrigtsen
@ 2006-04-14 18:13 ` Leon
2006-04-16 20:28 ` Mark Plaksin
1 sibling, 1 reply; 7+ messages in thread
From: Leon @ 2006-04-14 18:13 UTC (permalink / raw)
Mark Plaksin <happy@usg.edu> writes:
> Here's some code that lets you hide groups when they have just a few unread
> articles. You can set the threshold on a per-topic and/or per-group basis.
>
> I use levels to separate my groups by priority but I am subscribed to a lot
> of groups so each level contains a lot of groups. I'm easily distracted so
> I wanted a way to hide groups without many unread articles. That way when
> I check for new messages I don't end up reading two or three articles in
> each of 25 groups. Instead I generally end up reading one or two groups
> with 25 articles each.
>
> It requires a small patch to gnus-group.el which allows you to specify the
> predicate to use in the funcall to gnus-group-prepare-function. That's the
> first attachment. The second attachment does the rest of the work.
>
> You get a new group parameter called gnus-distraction-threshold. If a
> group has fewer than gnus-distraction-threshold unread articles, it won't
> be displayed. gnus-distraction-threshold defaults to 1 so nothing should
> change unless you set the threshold somewhere. As with any group parameter
> you can set it for a topic and have it apply to all groups in the topic.
> By default groups with ticked articles are always displayed.
>
> Two key bindings are turned on in the Group buffer:
> - C-cd toggles distraction prevention on and off
> - C-ct toggles the display of groups with ticked articles
>
> I've only been playing with this for a few days so comments and suggestions
> are very welcome!
>
A feature that I have been looking for! Wonderful.
Does it work for topic i.e hide a topic when the total number of
unread articles within a topic is below threshold?
Regards,
--
Leon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2006-04-14 15:17 ` Lars Magne Ingebrigtsen
@ 2006-04-16 20:27 ` Mark Plaksin
2006-04-17 8:59 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Mark Plaksin @ 2006-04-16 20:27 UTC (permalink / raw)
Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> Mark Plaksin <happy@usg.edu> writes:
>
>> You get a new group parameter called gnus-distraction-threshold. If a
>> group has fewer than gnus-distraction-threshold unread articles, it won't
>> be displayed.
>
> Interesting. This is something that I could well imagine using in a
> couple of the topics I have.
It's been especially useful for me when work is crazy busy. During those
times the only work-related groups I want to see are the ones with unread
articles. Ticked articles represent things that would be nice to catch up
on one day; unread articles must be handled ASAP.
Since posting the original version I've added a feature or two. I'll clean
it up and repost soon.
> Do you have copyright assignment papers on file with the FSF?
I don't would would be glad to. What do I do?
Katsumi mentioned filing papers when we were discussing some suggestions
and patches I made for nnrss.
I'm almost done adding Etag support to nnrss. It makes nnrss a lot faster.
There's just one *tiny* bug which makes nnrss-group-alist grow without
bound :)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2006-04-14 18:13 ` Leon
@ 2006-04-16 20:28 ` Mark Plaksin
0 siblings, 0 replies; 7+ messages in thread
From: Mark Plaksin @ 2006-04-16 20:28 UTC (permalink / raw)
Leon <sdl.web@gmail.com> writes:
> A feature that I have been looking for! Wonderful.
:)
> Does it work for topic i.e hide a topic when the total number of
> unread articles within a topic is below threshold?
Yes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2006-04-16 20:27 ` Mark Plaksin
@ 2006-04-17 8:59 ` Lars Magne Ingebrigtsen
2006-04-26 16:32 ` Reiner Steib
0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2006-04-17 8:59 UTC (permalink / raw)
Mark Plaksin <happy@mcplaksin.org> writes:
>> Do you have copyright assignment papers on file with the FSF?
>
> I don't would would be glad to. What do I do?
Err... I forget what the drill is these days. Anybody?
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: CODE: Hide groups with few unread articles
2006-04-17 8:59 ` Lars Magne Ingebrigtsen
@ 2006-04-26 16:32 ` Reiner Steib
0 siblings, 0 replies; 7+ messages in thread
From: Reiner Steib @ 2006-04-26 16:32 UTC (permalink / raw)
On Mon, Apr 17 2006, Lars Magne Ingebrigtsen wrote:
> Mark Plaksin <happy@mcplaksin.org> writes:
>
>>> Do you have copyright assignment papers on file with the FSF?
>>
>> I don't would would be glad to. What do I do?
>
> Err... I forget what the drill is these days. Anybody?
I will send Mark the forms tomorrow (please remind me if I forget).
Bye, Reiner.
P.S.: Resent this message as
<v9slocfmoo.fsf@marauder.physik.uni-ulm.de> didn't appear on the
list. In the meantime, I've sent the forms to Mark.
P.P.S.: No luck yet. Trying again.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-04-26 16:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-14 1:20 CODE: Hide groups with few unread articles Mark Plaksin
2006-04-14 15:17 ` Lars Magne Ingebrigtsen
2006-04-16 20:27 ` Mark Plaksin
2006-04-17 8:59 ` Lars Magne Ingebrigtsen
2006-04-26 16:32 ` Reiner Steib
2006-04-14 18:13 ` Leon
2006-04-16 20:28 ` Mark Plaksin
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).