Gnus development mailing list
 help / color / mirror / Atom feed
From: Karl Kleinpaste <karl@charcoal.com>
Subject: Patch for Summary thread tree using "%B"
Date: Mon, 23 Jul 2001 19:50:43 -0400	[thread overview]
Message-ID: <vxk3d7nmch8.fsf@cinnamon.vanillaknot.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

Below is a patch based on Timo Lilja's cool update to gnus-sum.el
posted to gnu.emacs.gnus (in his environment, for 5.8.8; here, updated
for latest Oort) which provides an interesting and extremely useful
thread tree in *Summary*, substituting textual trace lines via %B for
simple space-based indentation via %I.

See a simple text dump of what this provides:
http://www.cs.cmu.edu/~karl/gnus/screenshots/new-thread.text

I've included the small updates needed to the doc string for
gnus-summary-line-format in gnus.el and related commentary in
gnus.texi.

I've tried it out and it works great.  I haven't decided if I want to
use it for the long term, but it's certainly a useful feature that a
lot of people have talked about over the years.  Could the following
patch be applied by one of those with CVS write access?

--karl


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: thread tree patch against Oort --]
[-- Type: text/x-patch, Size: 4337 bytes --]

--- lisp/gnus.el.~1~	Fri Jul 13 22:43:11 2001
+++ lisp/gnus.el	Mon Jul 23 19:37:44 2001
@@ -2064,6 +2064,7 @@
 %c   Number of characters in the article (integer)
 %L   Number of lines in the article (integer)
 %I   Indentation based on thread level (a string of spaces)
+%B   A complex trn-style thread tree (string)
 %T   A string with two possible values: 80 spaces if the article
      is on thread level two or larger and 0 spaces on level one
 %R   \"A\" if this article has been replied to, \" \" otherwise (character)
--- lisp/gnus-sum.el.orig	Sun Jul 22 22:06:35 2001
+++ lisp/gnus-sum.el	Mon Jul 23 18:36:19 2001
@@ -1068,7 +1068,8 @@
 	 (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.
 These are paired with what variables they correspond with, along with
 the type of the variable (string, integer, character, etc).")
@@ -4090,6 +4091,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 ...]...) ...])'
@@ -4108,7 +4118,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)
 
@@ -4146,7 +4157,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))))
 
@@ -4313,7 +4325,22 @@
 	      ((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)
@@ -4332,7 +4359,11 @@
 	    (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
--- texi/gnus.texi.~1~	Fri Jul 20 14:08:41 2001
+++ texi/gnus.texi	Mon Jul 23 19:38:56 2001
@@ -4034,6 +4034,8 @@
 methods (like nnfolder).
 @item I
 Indentation based on thread level (@pxref{Customizing Threading}).
+@item B
+A complex trn-style thread tree, showing response-connecting trace lines.
 @item T
 Nothing if the article is a root and lots of spaces if it isn't (it
 pushes everything after it off the screen).

             reply	other threads:[~2001-07-23 23:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 23:50 Karl Kleinpaste [this message]
2001-07-24  5:06 ` ShengHuo ZHU
2001-07-24 17:37 ` Henrik Hansen
2001-07-24 19:32   ` Karl Kleinpaste
2001-07-24 19:55     ` Henrik Hansen
2001-07-25 21:46 ` [Patch] " Danny Siu
2001-07-25 22:19   ` ShengHuo ZHU
2001-07-27 22:35 ` Kai Großjohann

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=vxk3d7nmch8.fsf@cinnamon.vanillaknot.com \
    --to=karl@charcoal.com \
    /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).