Gnus development mailing list
 help / color / mirror / Atom feed
From: jdp@cam-orl.co.uk (John Porter)
Subject: topics with selective unread article visibility
Date: Thu, 29 Feb 1996 18:12:47 GMT	[thread overview]
Message-ID: <199602291812.SAA16354@dasheen.cam-orl.co.uk> (raw)


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


             reply	other threads:[~1996-02-29 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-29 18:12 John Porter [this message]
1996-02-29 22:49 ` Greg Stark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199602291812.SAA16354@dasheen.cam-orl.co.uk \
    --to=jdp@cam-orl.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).