From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/5387 Path: main.gmane.org!not-for-mail From: jdp@cam-orl.co.uk (John Porter) Newsgroups: gmane.emacs.gnus.general Subject: topics with selective unread article visibility Date: Thu, 29 Feb 1996 18:12:47 GMT Message-ID: <199602291812.SAA16354@dasheen.cam-orl.co.uk> NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035145998 32641 80.91.224.250 (20 Oct 2002 20:33:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:33:18 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.7.3/8.6.9) with SMTP id KAA07693 for ; Thu, 29 Feb 1996 10:49:07 -0800 Original-Received: from quince.cam-orl.co.uk (quince.cam-orl.co.uk [192.5.239.65]) by ifi.uio.no with SMTP (8.6.11/ifi2.4) id for ; Thu, 29 Feb 1996 19:12:51 +0100 Original-Received: from dasheen.cam-orl.co.uk by quince.cam-orl.co.uk with smtp (Smail3.1.28.1 #2) id m0tsCqN-00057eC; Thu, 29 Feb 96 18:12 GMT Original-Received: by dasheen.cam-orl.co.uk (SMI-8.6/SMI-SVR4-ORL-0.1) id SAA16354; Thu, 29 Feb 1996 18:12:47 GMT Original-To: ding@ifi.uio.no Xref: main.gmane.org gmane.emacs.gnus.general:5387 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:5387 I have just moved from September Gnus from Gnus5.0 and have to say that its just fantastic. Topics are wonderful. However, I wanted to be able to list groups without unread articles independently in different topics. I use different nnml groups to store old articles and often want to enter a particular group without having to list every group in every topic. In order to do this I hacked gnus-topic.el slightly. I couldn't see what 'show' and 'hidden' where for in the topology list, so I hijacked them to represent whether unread articles should be displayed or hidden. 'l' and 'L' are now bound so that they will change the visibility of unread articles for a particular topic. Here are the diffs if anybody is interested..... *************** *** 35,47 **** (defvar gnus-topic-mode-hook nil "Hook run in topic mode buffers.") ! (defvar gnus-topic-line-format "%i[ %(%{%n%}%) -- %A ]%v\n" "Format of topic lines. It works along the same lines as a normal formatting string, with some simple extensions. %i Indentation based on topic level. %n Topic name. %v Nothing if the topic is visible, \"...\" otherwise. %g Number of groups in the topic. %a Number of unread articles in the groups in the topic. --- 35,49 ---- (defvar gnus-topic-mode-hook nil "Hook run in topic mode buffers.") ! ;; *jdp* added %h format for hidden topics ! (defvar gnus-topic-line-format "%i[ %(%{%n%}%) -- %A ]%h%v\n" "Format of topic lines. It works along the same lines as a normal formatting string, with some simple extensions. %i Indentation based on topic level. %n Topic name. + %h hidden - or shown + %v Nothing if the topic is visible, \"...\" otherwise. %g Number of groups in the topic. %a Number of unread articles in the groups in the topic. *************** *** 59,68 **** (defvar gnus-topic-killed-topics nil) (defvar gnus-topic-inhibit-change-level nil) ! (defconst gnus-topic-line-format-alist `((?n name ?s) (?v visible ?s) (?i indentation ?s) (?g number-of-groups ?d) (?a (gnus-topic-articles-in-topic entries) ?d) --- 61,71 ---- (defvar gnus-topic-killed-topics nil) (defvar gnus-topic-inhibit-change-level nil) ! ;; *jdp* added hidden variable (defconst gnus-topic-line-format-alist `((?n name ?s) (?v visible ?s) + (?h hidden ?s) (?i indentation ?s) (?g number-of-groups ?d) (?a (gnus-topic-articles-in-topic entries) ?d) *************** *** 141,147 **** If SILENT, don't insert anything. Return the number of unread articles in the topic and its subtopics." (let* ((type (pop topic)) ! (entries (gnus-topic-find-groups (car type) list-level all)) (visiblep (and (eq (nth 1 type) 'visible) (not silent))) (gnus-group-indentation (make-string (* gnus-topic-indent-level level) ? )) --- 144,151 ---- If SILENT, don't insert anything. Return the number of unread articles in the topic and its subtopics." (let* ((type (pop topic)) ! (allp (and all (not (eq (nth 2 type) 'hidden)))) ! (entries (gnus-topic-find-groups (car type) list-level allp)) (visiblep (and (eq (nth 1 type) 'visible) (not silent))) (gnus-group-indentation (make-string (* gnus-topic-indent-level level) ? )) *************** *** 154,160 **** (while topic (incf unread (gnus-topic-prepare-topic ! (pop topic) (1+ level) list-level all (not visiblep)))) (setq end (point)) (goto-char beg) --- 158,164 ---- (while topic (incf unread (gnus-topic-prepare-topic ! (pop topic) (1+ level) list-level allp (not visiblep)))) (setq end (point)) (goto-char beg) *************** *** 274,279 **** --- 278,284 ---- (defun gnus-topic-insert-topic-line (name visiblep shownp level entries &optional unread) (let* ((visible (if visiblep "" "...")) + (hidden (if shownp "+" "-")) (indentation (make-string (* gnus-topic-indent-level level) ? )) (total-number-of-articles unread) (number-of-groups (length entries)) *************** *** 545,550 **** --- 550,557 ---- "\M-g" gnus-topic-get-new-news-this-topic "\C-i" gnus-topic-indent "AT" gnus-topic-list-active + "l" gnus-topic-show-new-topic + "L" gnus-topic-show-all-topic gnus-mouse-2 gnus-mouse-pick-topic) ;; Define a new submap. *************** *** 555,562 **** "m" gnus-topic-move-group "D" gnus-topic-remove-group "c" gnus-topic-copy-group ! "h" gnus-topic-hide-topic ! "s" gnus-topic-show-topic "M" gnus-topic-move-matching "C" gnus-topic-copy-matching "r" gnus-topic-rename --- 562,569 ---- "m" gnus-topic-move-group "D" gnus-topic-remove-group "c" gnus-topic-copy-group ! ;"h" gnus-topic-hide-topic ! ;"s" gnus-topic-show-topic "M" gnus-topic-move-matching "C" gnus-topic-copy-matching "r" gnus-topic-rename *************** *** 819,824 **** --- 826,865 ---- (interactive) (when (gnus-group-topic-p) (gnus-topic-remove-topic t nil 'shown))) + + + ;; *jdp* additions for selective display of groups with news + (defun gnus-topic-show-all-topic () + "make the topic show all groups" + (interactive) + (gnus-topic-reshow-topic t)) + + (defun gnus-topic-show-new-topic () + "make the current topic show only groups with news" + (interactive) + (gnus-topic-reshow-topic nil) + ) + + (defun gnus-topic-set-hidden (topic show) + "set the hidden flag in the the topology for group" + (setcdr (cdr (car (cdr (gnus-topic-find-topology topic)))) + (list (if show 'show 'hidden)))) + + (defun gnus-topic-reshow-topic (&optional all) + "redisplay a topic entry with different groups visible" + (let ((topic (gnus-group-topic-name)) + (level (gnus-group-topic-level)) + (beg (progn (beginning-of-line) (point))) + buffer-read-only) + (when topic + (while (and (zerop (forward-line 1)) + (> (or (gnus-group-topic-level) (1+ level)) level))) + (delete-region beg (point)) + (gnus-topic-set-hidden topic all) + (gnus-group-prepare-topics 7 all nil nil topic)))) + + ;; *jdp* end addition + (defun gnus-topic-mark-topic (topic) "Mark all groups in the topic with the process mark." -- John Porter Olivetti Research Lab, email: jporter@cam-orl.co.uk 24a Trumpington St, phone: +44-1223-343-344 Cambridge UK, CB2 1QA fax: +44-1223-313-542