Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] Thread tree display to Summary buffer
@ 2000-07-11 12:59 Timo Lilja
  0 siblings, 0 replies; only message in thread
From: Timo Lilja @ 2000-07-11 12:59 UTC (permalink / raw)


Hi!

Few weeks ago I posted here a patch to add thread tree display to
Summary buffer. There were some bugs in it, so here's a bit improved
version. 

Is there any interest to include this patch into Gnus? 

The patch is for Gnus version 5.8.3 

--- /usr/share/emacs/site-lisp/gnus/gnus-sum.el	Wed Jan 26 01:23:18 2000
+++ gnus-sum.el	Tue Jul 11 15:38:52 2000
@@ -1,3 +1,4 @@
+;;; LOCAL: patched to add thread tree
 ;;; gnus-sum.el --- summary mode commands for Gnus
 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
 
@@ -941,11 +942,13 @@
 	 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
 	?c)
     (?u gnus-tmp-user-defined ?s)
-    (?P (gnus-pick-line-number) ?d))
+    (?P (gnus-pick-line-number) ?d)
+    (?B gnus-tmp-thread-tree-header-string ?s))
   "An alist of format specifications that can appear in summary lines,
 and what variables they correspond with, along with the type of the
 variable (string, integer, character, etc).")
 
+
 (defvar gnus-summary-dummy-line-format-alist
   `((?S gnus-tmp-subject ?s)
     (?N gnus-tmp-number ?d)
@@ -3768,6 +3771,15 @@
   (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
       ""))
 
+(defvar gnus-tmp-thread-tree-header-string "")
+
+(defvar gnus-sum-thread-tree-root "> ")
+(defvar gnus-sum-thread-tree-single-indent "")
+(defvar gnus-sum-thread-tree-vertical "| ")
+(defvar gnus-sum-thread-tree-indent "  ")
+(defvar gnus-sum-thread-tree-leaf-with-other "+-> ")
+(defvar gnus-sum-thread-tree-single-leaf "\\-> ")
+
 (defun gnus-summary-prepare-threads (threads)
   "Prepare summary buffer from THREADS and indentation LEVEL.
 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
@@ -3786,7 +3798,8 @@
 	gnus-tmp-replied gnus-tmp-subject-or-nil
 	gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
 	gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
-	gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
+	gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
+        tree-stack)
 
     (setq gnus-tmp-prev-subject nil)
 
@@ -3824,7 +3837,8 @@
 	    ;; the stack.
 	    (setq state (car stack)
 		  gnus-tmp-level (car state)
-		  thread (cdr state)
+                  tree-stack (cadr state)
+		  thread (caddr state)
 		  stack (cdr stack)
 		  gnus-tmp-header (caar thread))))
 
@@ -3923,13 +3937,14 @@
 	       gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
 	      (setq gnus-tmp-dummy-line nil))
 
+
 	    ;; Compute the mark.
 	    (setq gnus-tmp-unread (gnus-article-mark number))
 
 	    (push (gnus-data-make number gnus-tmp-unread (1+ (point))
 				  gnus-tmp-header gnus-tmp-level)
 		  gnus-newsgroup-data)
-
+            
 	    ;; Actually insert the line.
 	    (setq
 	     gnus-tmp-subject-or-nil
@@ -3990,7 +4005,21 @@
 	      ((string-match "(.+)" gnus-tmp-from)
 	       (substring gnus-tmp-from
 			  (1+ (match-beginning 0)) (1- (match-end 0))))
-	      (t gnus-tmp-from)))
+	      (t gnus-tmp-from))
+             gnus-tmp-thread-tree-header-string 
+             (if (zerop gnus-tmp-level)
+                 (if (cdar thread) 
+                     gnus-sum-thread-tree-root
+                   gnus-sum-thread-tree-single-indent)
+               (concat (apply 'concat (mapcar (lambda (item) 
+                                              (if (= item 1) 
+                                                  gnus-sum-thread-tree-vertical
+                                                gnus-sum-thread-tree-indent))
+                                            (cdr (reverse tree-stack))))
+                       (if (nth 1 thread) 
+                           gnus-sum-thread-tree-leaf-with-other
+                         gnus-sum-thread-tree-single-leaf))))
+
 	    (when (string= gnus-tmp-name "")
 	      (setq gnus-tmp-name gnus-tmp-from))
 	    (unless (numberp gnus-tmp-lines)
@@ -4007,7 +4036,13 @@
 	    (setq gnus-tmp-prev-subject subject)))
 
 	(when (nth 1 thread)
-	  (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
+	  (push (list (max 0 gnus-tmp-level) 
+                      (copy-list tree-stack)
+                      (nthcdr 1 thread))
+                stack))
+
+        (push (if (nth 1 thread) 1 0) tree-stack)
+
 	(incf gnus-tmp-level)
 	(setq threads (if thread-end nil (cdar thread)))
 	(unless threads


-- 
!tlilja@cc.hut.fi!



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-11 12:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-11 12:59 [patch] Thread tree display to Summary buffer Timo Lilja

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).