Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-group-list-ticked
@ 2011-03-17 17:42 Antoine Levitt
  2011-03-17 17:57 ` gnus-group-list-ticked Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Antoine Levitt @ 2011-03-17 17:42 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

Hi,

gnus-group has functions to list groups with dormant or cached articles,
but not ticked. That might be useful for some setups (for instance, I
have gnus-list-groups-with-ticked-articles set to nil and periodically
check my ticked messages with this), or just to look at groups with
ticked articles, and not unread ones. The following patch does just
that, and provides a binding for it. It's a trivial copy/paste from
gnus-group-list-dormant and -cached. There didn't seem to be much point
in abstracting the code out of these functions, since there are simple
wrappers around gnus-group-prepare-function.

Speaking of which, the interface in gnus-group-prepare-function is
slightly different than the one in gnus-group-prepare-flat, and code
calls gnus-group-prepare-function assuming the extended interface from
gnus-group-prepare-flat. Seems to me either gnus-group-prepare-function
should document the extended interface, or it should just be dispensed
with and gnus-group-prepare-flat called directly. Any reason to leave
the indirection?

Antoine


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-group-list-ticked.diff --]
[-- Type: text/x-diff, Size: 2424 bytes --]

diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 90f3625..8d6c461 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-17  Antoine Levitt  <antoine.levitt@gmail.com>
+
+	* gnus-group.el (gnus-group-list-ticked): New function.
+	(gnus-group-make-menu-bar): Provide a menu entry for it.
+	(gnus-group-list-map): Provide a binding for it.
+
 2011-03-16  Julien Danjou  <julien@danjou.info>
 
 	* mm-uu.el (mm-uu-dissect-text-parts): Only dissect handle that are
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index e928811..c265538 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -697,7 +697,8 @@ simple manner.")
   "M" gnus-group-list-all-matching
   "l" gnus-group-list-level
   "c" gnus-group-list-cached
-  "?" gnus-group-list-dormant)
+  "?" gnus-group-list-dormant
+  "!" gnus-group-list-ticked)
 
 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
   "k"  gnus-group-list-limit
@@ -849,7 +850,8 @@ simple manner.")
 	["List all groups matching..." gnus-group-list-all-matching t]
 	["List active file" gnus-group-list-active t]
 	["List groups with cached" gnus-group-list-cached t]
-	["List groups with dormant" gnus-group-list-dormant t])
+	["List groups with dormant" gnus-group-list-dormant t]
+	["List groups with ticked" gnus-group-list-ticked t])
        ("Sort"
 	["Default sort" gnus-group-sort-groups t]
 	["Sort by method" gnus-group-sort-groups-by-method t]
@@ -4536,6 +4538,28 @@ This command may read the active file."
   (goto-char (point-min))
   (gnus-group-position-point))
 
+(defun gnus-group-list-ticked (level &optional lowest)
+  "List all groups with ticked articles.
+If the prefix LEVEL is non-nil, it should be a number that says which
+level to cut off listing groups.
+If LOWEST, don't list groups with level lower than LOWEST.
+
+This command may read the active file."
+  (interactive "P")
+  (when level
+    (setq level (prefix-numeric-value level)))
+  (when (or (not level) (>= level gnus-level-zombie))
+    (gnus-cache-open))
+  (funcall gnus-group-prepare-function
+	   (or level gnus-level-subscribed)
+	   #'(lambda (info)
+	       (let ((marks (gnus-info-marks info)))
+		 (assq 'tick marks)))
+	   lowest
+	   'ignore)
+  (goto-char (point-min))
+  (gnus-group-position-point))
+
 (defun gnus-group-listed-groups ()
   "Return a list of listed groups."
   (let (point groups)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnus-group-list-ticked
  2011-03-17 17:42 gnus-group-list-ticked Antoine Levitt
@ 2011-03-17 17:57 ` Lars Magne Ingebrigtsen
  2011-03-19  0:45   ` gnus-group-list-ticked Antoine Levitt
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-03-17 17:57 UTC (permalink / raw)
  To: ding

Antoine Levitt <antoine.levitt@gmail.com> writes:

> The following patch does just that, and provides a binding for it.

Thanks; applied.  Could you provide a patch to gnus.texi, too?

> Speaking of which, the interface in gnus-group-prepare-function is
> slightly different than the one in gnus-group-prepare-flat, and code
> calls gnus-group-prepare-function assuming the extended interface from
> gnus-group-prepare-flat. Seems to me either gnus-group-prepare-function
> should document the extended interface, or it should just be dispensed
> with and gnus-group-prepare-flat called directly. Any reason to leave
> the indirection?

Hm...  I don't remember any more?  Perhaps it has something to do with
topics?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnus-group-list-ticked
  2011-03-17 17:57 ` gnus-group-list-ticked Lars Magne Ingebrigtsen
@ 2011-03-19  0:45   ` Antoine Levitt
  2011-03-29 18:37     ` gnus-group-list-ticked Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Antoine Levitt @ 2011-03-19  0:45 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 924 bytes --]

17/03/11 18:57, Lars Magne Ingebrigtsen
> Antoine Levitt <antoine.levitt@gmail.com> writes:
>
>> The following patch does just that, and provides a binding for it.
>
> Thanks; applied.  Could you provide a patch to gnus.texi, too?

Oops, forgot about that, sorry. Here it is.

>
>> Speaking of which, the interface in gnus-group-prepare-function is
>> slightly different than the one in gnus-group-prepare-flat, and code
>> calls gnus-group-prepare-function assuming the extended interface from
>> gnus-group-prepare-flat. Seems to me either gnus-group-prepare-function
>> should document the extended interface, or it should just be dispensed
>> with and gnus-group-prepare-flat called directly. Any reason to leave
>> the indirection?
>
> Hm...  I don't remember any more?  Perhaps it has something to do with
> topics?

Doesn't seem so, since gnus-group-prepare-flat is the only function
called, even when using topics.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: doc-gnus-group-list-ticked.diff --]
[-- Type: text/x-diff, Size: 1010 bytes --]

diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 79b30a2..1c4cd4a 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-19  Antoine Levitt  <antoine.levitt@gmail.com>
+
+	* gnus.texi (Listing Groups): Document gnus-group-list-ticked
+
 2011-03-17  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc.texi (Logarithmic Units): Update the function names.
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index b55452c..9771392 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -3320,6 +3320,11 @@ List all groups with cached articles (@code{gnus-group-list-cached}).
 @findex gnus-group-list-dormant
 List all groups with dormant articles (@code{gnus-group-list-dormant}).
 
+@item A !
+@kindex A ! (Group)
+@findex gnus-group-list-ticked
+List all groups with ticked articles (@code{gnus-group-list-ticked}).
+
 @item A /
 @kindex A / (Group)
 @findex gnus-group-list-limit
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 90f3625..8d6c461 100644

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gnus-group-list-ticked
  2011-03-19  0:45   ` gnus-group-list-ticked Antoine Levitt
@ 2011-03-29 18:37     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-03-29 18:37 UTC (permalink / raw)
  To: ding

Antoine Levitt <antoine.levitt@gmail.com> writes:

>> Thanks; applied.  Could you provide a patch to gnus.texi, too?
>
> Oops, forgot about that, sorry. Here it is.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-29 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-17 17:42 gnus-group-list-ticked Antoine Levitt
2011-03-17 17:57 ` gnus-group-list-ticked Lars Magne Ingebrigtsen
2011-03-19  0:45   ` gnus-group-list-ticked Antoine Levitt
2011-03-29 18:37     ` gnus-group-list-ticked Lars Magne Ingebrigtsen

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).