From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/56714 Path: main.gmane.org!not-for-mail From: David Hanak Newsgroups: gmane.emacs.gnus.general Subject: Exact article count for nnml groups Date: Fri, 12 Mar 2004 12:51:26 -0600 Organization: Institute for Software Integrated Systems, Vanderbilt University Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1079123300 31839 80.91.224.253 (12 Mar 2004 20:28:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Mar 2004 20:28:20 +0000 (UTC) Original-X-From: ding-owner+M5253@lists.math.uh.edu Fri Mar 12 21:28:12 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B1tGN-0002E8-00 for ; Fri, 12 Mar 2004 21:28:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1B1tF7-00088R-00; Fri, 12 Mar 2004 14:26:53 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1B1rke-0007v7-00 for ding@lists.math.uh.edu; Fri, 12 Mar 2004 12:51:20 -0600 Original-Received: from quimby.gnus.org (quimby.gnus.org [80.91.224.244]) by justine.libertine.org (Postfix) with ESMTP id B10213A0043 for ; Fri, 12 Mar 2004 12:51:18 -0600 (CST) Original-Received: from news by quimby.gnus.org with local (Exim 3.35 #1 (Debian)) id 1B1rkb-0005iO-00 for ; Fri, 12 Mar 2004 19:51:17 +0100 Original-To: ding@gnus.org Original-Path: not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 143 Original-NNTP-Posting-Host: a139106.n1.vanderbilt.edu Original-X-Trace: quimby.gnus.org 1079117477 19453 129.59.139.106 (12 Mar 2004 18:51:17 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Fri, 12 Mar 2004 18:51:17 +0000 (UTC) User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:D3l1ZQLZR/Cg29jf5nADue+N1Ws= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:56714 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:56714 --=-=-= Hi, Here's a patch I submitted last June which allows the group buffer to show exact article counts for nnml groups instead of the estimate based on the difference of the greatest and smallest article numbers. Kai then helped me to improve it a bit, and then suggested to wait until the feature freeze is over. I guess it is over now, and it would be nice if it could be integrated into No Gnus. (I have all the paperwork done.) It is fairly simple, and perhaps a little bit out of date (after all, the lisp files I patched were probably modified since then), but since they're only additions, it shouldn't be too hard to merge them. Also, if anyone writes functions to retrieve the list of existing article numbers for any other backend than nnml, i.e., nnimap, then it should be able to display exact article counts for those backends, too. Cheers, -- David Hanak - Research Engineer Institute for Software Integrated Systems | http://www.isis.vanderbilt.edu Vanderbilt University | Work phone: (615) 343 1319 Box 1829, Station B, Nashville, TN 37235 | PGP key ID: 266BC45F P.S.: I tried to post this message two times before, first to the newsgroup, second time to the ding@gnus.org list address. However, my posting didn't appear on the newsgroup, while other postings kept coming. Is it because I used a spamified sender address? I try to post with my real address this time, hope it works. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gnus.patch *** /usr/share/emacs/site-lisp/gnus/lisp/gnus-sum.el 2003-06-07 19:40:22.000000000 +0200 --- ./gnus-sum.el 2003-06-10 15:07:41.000000000 +0200 *************** *** 1092,1097 **** --- 1092,1106 ---- :type 'boolean :group 'gnus-article-mime) + (defcustom gnus-count-articles-in-groups nil + "*Regexp to match groups whose article count should be determined + accurately upon entering the group. Non-matching groups are conventionally + looked up in the active info. + + If t, matches all groups, if nil, matches none." + :type '(choice regexp (const t) (const nil)) + :group 'gnus-summary) + ;;; Internal variables (defvar gnus-summary-display-cache nil) *************** *** 5226,5231 **** --- 5235,5273 ---- (memq article gnus-newsgroup-recent)) (t t)))) + (defun gnus-get-group-articles-list (group) + "Return a list of group articles if `gnus-count-articles-in-groups' + matches GROUP as a regexp. Otherwise return nil." + (let ((group-real-name (gnus-group-real-name group))) + (when (and gnus-count-articles-in-groups + (or (eq gnus-count-articles-in-groups t) + (string-match gnus-count-articles-in-groups group))) + (let ((gnus-command-method (gnus-find-method-for-group group)) + (func1 'get-group-articles-list) + (func2 'request-group-articles)) + (or (and (gnus-check-backend-function func1 group) + (funcall (gnus-get-function gnus-command-method func1) + group-real-name (nth 1 gnus-command-method))) + (and (gnus-check-backend-function func2 group) + (funcall (gnus-get-function gnus-command-method func2) + group-real-name (nth 1 gnus-command-method)) + (gnus-parse-group-articles-list))))))) + + (defun gnus-parse-group-articles-list () + "Parse article list from `nntp-server-buffer'." + (condition-case () + (save-excursion + (set-buffer nntp-server-buffer) + (goto-char (point-min)) ; first line contains comment + (delete-region (point) (line-end-position)) + (insert "(") + (goto-char (point-max)) + (forward-line -1) ; last line contains "." + (delete-region (point) (line-end-position)) + (insert ")") + (read (point-min-marker))) + (error nil))) + (defun gnus-articles-to-read (group &optional read-all) "Find out what articles the user wants to read." (let* ((display (gnus-group-find-parameter group 'display)) *************** *** 5242,5247 **** --- 5284,5290 ---- ;; articles in the group, or (if that's nil), the ;; articles in the cache. (or + (gnus-get-group-articles-list group) (gnus-uncompress-range (gnus-active group)) (gnus-cache-articles-in-group group)) ;; Select only the "normal" subset of articles. *** /usr/share/emacs/site-lisp/gnus/lisp/nnml.el 2003-05-01 16:23:15.000000000 +0200 --- ./nnml.el 2003-06-10 15:11:41.000000000 +0200 *************** *** 1007,1012 **** --- 1007,1033 ---- (nnml-save-marks group server) (nnheader-message 7 "Bootstrapping marks for %s...done" group))))) + (deffoo nnml-get-group-articles-list (group &optional server) + "Return the list of existing articles in GROUP directly. See also + `nnml-request-group-articles'." + (sort (nnheader-directory-articles + (nnheader-group-pathname group nnml-directory)) + '<)) + + (deffoo nnml-request-group-articles (group &optional server) + "Return the list of existing articles in GROUP in `nntp-server-buffer'." + (let ((article-list (nnml-get-group-articles-list group server))) + (condition-case () + (save-excursion + (set-buffer nntp-server-buffer) + (erase-buffer) + (insert "211 Article list follows\n") + (mapcar '(lambda (x) (insert (number-to-string x) "\n")) + article-list) + (insert ".\n") + t) + (error nil)))) + (provide 'nnml) ;;; nnml.el ends here --=-=-=--