From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/77895 Path: news.gmane.org!not-for-mail From: Antoine Levitt Newsgroups: gmane.emacs.gnus.general Subject: gnus-group-list-ticked Date: Thu, 17 Mar 2011 18:42:05 +0100 Message-ID: <87aagtr6du.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1300383756 2400 80.91.229.12 (17 Mar 2011 17:42:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Mar 2011 17:42:36 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M26213@lists.math.uh.edu Thu Mar 17 18:42:32 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0HDN-0005Ub-Md for ding-account@gmane.org; Thu, 17 Mar 2011 18:42:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Q0HDL-0001uz-F6; Thu, 17 Mar 2011 12:42:23 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Q0HDJ-0001ul-TH for ding@lists.math.uh.edu; Thu, 17 Mar 2011 12:42:21 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Q0HDI-0005vu-DM for ding@lists.math.uh.edu; Thu, 17 Mar 2011 12:42:21 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Q0HDH-0007oP-MX for ding@gnus.org; Thu, 17 Mar 2011 18:42:19 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q0HDF-0005L5-TJ for ding@gnus.org; Thu, 17 Mar 2011 18:42:17 +0100 Original-Received: from portable115.ceremade.dauphine.fr ([193.48.71.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Mar 2011 18:42:17 +0100 Original-Received: from antoine.levitt by portable115.ceremade.dauphine.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Mar 2011 18:42:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 99 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: portable115.ceremade.dauphine.fr User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Spam-Score: -1.0 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:77895 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=gnus-group-list-ticked.diff 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 + + * 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 * 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) --=-=-=--