From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/49169 Path: main.gmane.org!not-for-mail From: Lloyd Zusman Newsgroups: gmane.emacs.gnus.general Subject: A solution that's better than my ugly hack? Date: Mon, 13 Jan 2003 13:47:17 -0500 Organization: FreeBSD/Linux Hippopotamus Preserve Sender: owner-ding@hpc.uh.edu Message-ID: <8665ssevka.fsf_-_@asfast.com> References: <86fzsc4ii2.fsf@asfast.com> <84k7hnjxqi.fsf@lucy.cs.uni-dortmund.de> <86y9638l7i.fsf@asfast.com> <86ptrfc6oy.fsf@asfast.com> <86hecrc56e.fsf@asfast.com> <86el7vc4xw.fsf@asfast.com> <8665t6de1c.fsf@asfast.com> <8665t4bwp2.fsf@asfast.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1042483659 20910 80.91.224.249 (13 Jan 2003 18:47:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 13 Jan 2003 18:47:39 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18Y9cW-0005Qu-00 for ; Mon, 13 Jan 2003 19:47:37 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18Y9cZ-0008LR-00; Mon, 13 Jan 2003 12:47:39 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 13 Jan 2003 12:48:35 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [66.230.238.2]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id MAA02391 for ; Mon, 13 Jan 2003 12:48:22 -0600 (CST) Original-Received: (qmail 61522 invoked by alias); 13 Jan 2003 18:47:19 -0000 Original-Received: (qmail 61517 invoked from network); 13 Jan 2003 18:47:18 -0000 Original-Received: from home.acholado.net (HELO home) (Potamus@216.27.138.216) by 66.230.238.6 with SMTP; 13 Jan 2003 18:47:18 -0000 Original-Received: from localhost (localhost [127.0.0.1]) (uid 1001) by home with local; Mon, 13 Jan 2003 13:47:17 -0500 Original-To: ding@gnus.org X-Face: "!ga1s|?LNLE3MeeeEYs(%LIl9q[xV9!j4#xf4!**BFW_ihlOb;:Slb>)vy>CJM (Lloyd Zusman's message of "Sat, 04 Jan 2003 13:23:53 -0500") User-Agent: Gnus/5.090011 (Oort Gnus v0.11) XEmacs/21.4 (Common Lisp, i386-debian-linux) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:49169 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:49169 A week or two ago I posted this ugly hack here (quoted below) to provide a feature that I've wanted: if I enter a group with no unread articles, I only see the last N already-read articles (where N is configurable), instead of the entire set of already-read's; but if I enter a group with at least one unread article, I only see the unreads (and in both cases, I'd also see the ticked and dormant articles). Has anyone been able to figure out a cleaner way of getting this same functionality, instead of this horrible, defadvice-based hack? Thanks in advance. > (defvar ljz-group-default-display-count 256 > "*Default count of articles to display when entering a group, if there > are no unread, dormant, or ticked articles, and if there is no prefix > argument.") > > ;; Yes, I know that all of the variables defined in the `let*' clause > ;; are not really necessary, but I put them there so I could more easily > ;; put meaningful debug statements into the code during development. > (defadvice gnus-group-read-group (around gnus-group-read-group freeze) > (interactive "P") > (let* ((the-group (or group (gnus-group-group-name))) > (the-unread-count (gnus-group-unread the-group)) > (the-marks (gnus-info-marks (gnus-get-info the-group))) > (the-dormant (cdr (assq 'dormant the-marks))) > (the-ticked (cdr (assq 'tick the-marks))) > (the-count > (+ the-unread-count (length the-dormant) (length the-ticked))) > (the-parameter (if all all (if (> the-count 0) > nil > ljz-group-default-display-count)))) > (ad-set-arg 0 the-parameter) > ad-do-it)) > -- Lloyd Zusman ljz@asfast.com