Gnus development mailing list
 help / color / mirror / Atom feed
* Patch for Summary thread tree using "%B"
@ 2001-07-23 23:50 Karl Kleinpaste
  2001-07-24  5:06 ` ShengHuo ZHU
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Karl Kleinpaste @ 2001-07-23 23:50 UTC (permalink / 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).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for Summary thread tree using "%B"
  2001-07-23 23:50 Patch for Summary thread tree using "%B" Karl Kleinpaste
@ 2001-07-24  5:06 ` ShengHuo ZHU
  2001-07-24 17:37 ` Henrik Hansen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: ShengHuo ZHU @ 2001-07-24  5:06 UTC (permalink / raw)


Karl Kleinpaste <karl@charcoal.com> writes:

> 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?

Installed.

ShengHuo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for Summary thread tree using "%B"
  2001-07-23 23:50 Patch for Summary thread tree using "%B" Karl Kleinpaste
  2001-07-24  5:06 ` ShengHuo ZHU
@ 2001-07-24 17:37 ` Henrik Hansen
  2001-07-24 19:32   ` Karl Kleinpaste
  2001-07-25 21:46 ` [Patch] " Danny Siu
  2001-07-27 22:35 ` Kai Großjohann
  3 siblings, 1 reply; 8+ messages in thread
From: Henrik Hansen @ 2001-07-24 17:37 UTC (permalink / raw)


Karl Kleinpaste <karl@charcoal.com> wrote:

 > 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?
 > 

It looks cool, can I get a hint on how to use it?

-- 
Henrik Hansen



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for Summary thread tree using "%B"
  2001-07-24 17:37 ` Henrik Hansen
@ 2001-07-24 19:32   ` Karl Kleinpaste
  2001-07-24 19:55     ` Henrik Hansen
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Kleinpaste @ 2001-07-24 19:32 UTC (permalink / raw)


Henrik Hansen <hh@mailserver.dk> writes:
> It looks cool, can I get a hint on how to use it?

Just read carefully:

>> ...substituting textual trace lines via %B for
>> simple space-based indentation via %I.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for Summary thread tree using "%B"
  2001-07-24 19:32   ` Karl Kleinpaste
@ 2001-07-24 19:55     ` Henrik Hansen
  0 siblings, 0 replies; 8+ messages in thread
From: Henrik Hansen @ 2001-07-24 19:55 UTC (permalink / raw)


Karl Kleinpaste <karl@charcoal.com> wrote:

 > Henrik Hansen <hh@mailserver.dk> writes:
>> It looks cool, can I get a hint on how to use it?
 > 
 > Just read carefully:
 > 
>>> ...substituting textual trace lines via %B for
>>> simple space-based indentation via %I.
 > 

ahh in summary-line, cool it works, looks nice :)

-- 
Henrik Hansen



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Patch] Re: Patch for Summary thread tree using "%B"
  2001-07-23 23:50 Patch for Summary thread tree using "%B" Karl Kleinpaste
  2001-07-24  5:06 ` ShengHuo ZHU
  2001-07-24 17:37 ` Henrik Hansen
@ 2001-07-25 21:46 ` Danny Siu
  2001-07-25 22:19   ` ShengHuo ZHU
  2001-07-27 22:35 ` Kai Großjohann
  3 siblings, 1 reply; 8+ messages in thread
From: Danny Siu @ 2001-07-25 21:46 UTC (permalink / raw)


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


If threading is turned off (T T in summary buffer) and %B is used in
g-s-line-format, an extra gnus-sum-thread-tree-single-leaf "\-> " would be
inserted.  I have attached a patch to fixed this.  It is a diff against the
latest (7/24/01 5pm) CVS.

Can someone who has write access commit the patch?

Thanks!
-- 
Danny Dick-Fung Siu        mailto:dsiu@adobe.com
Acrobat Engineering @ Adobe Systems Incorporated


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-sum-tree-patch.diff --]
[-- Type: text/x-patch, Size: 3015 bytes --]

diff -C5 orig/ChangeLog ./ChangeLog
*** orig/ChangeLog	Wed Jul 25 13:02:31 2001
--- ./ChangeLog	Wed Jul 25 12:57:56 2001
***************
*** 1,5 ****
--- 1,9 ----
+ 2001-07-25 12:54:00  Danny Siu <dsiu@adobe.com>
+ 	* gnus-sum.el (gnus-summary-prepare-threads): Shouldn't do tree
+ 	display (%B) for threads if threading is off.
+ 
  2001-07-24 13:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
  
  	* gnus-sum.el (gnus-summary-display-arrow): Test fboundp.
  
  2001-07-24 12:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
diff -C5 orig/gnus-sum.el ./gnus-sum.el
*** orig/gnus-sum.el	Tue Jul 24 15:15:07 2001
--- ./gnus-sum.el	Wed Jul 25 12:48:42 2001
***************
*** 4324,4346 ****
  	      ((string-match "(.+)" gnus-tmp-from)
  	       (substring gnus-tmp-from
  			  (1+ (match-beginning 0)) (1- (match-end 0))))
  	      (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)
  	      (setq gnus-tmp-lines -1))
--- 4324,4349 ----
  	      ((string-match "(.+)" gnus-tmp-from)
  	       (substring gnus-tmp-from
  			  (1+ (match-beginning 0)) (1- (match-end 0))))
  	      (t gnus-tmp-from))
               gnus-tmp-thread-tree-header-string 
!              (cond 
!               ((not gnus-show-threads) "")
!                ((zerop gnus-tmp-level)
!                 (if (cdar thread) 
!                     gnus-sum-thread-tree-root
!                   gnus-sum-thread-tree-single-indent))
!                (t
!                 (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)
  	      (setq gnus-tmp-lines -1))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Patch] Re: Patch for Summary thread tree using "%B"
  2001-07-25 21:46 ` [Patch] " Danny Siu
@ 2001-07-25 22:19   ` ShengHuo ZHU
  0 siblings, 0 replies; 8+ messages in thread
From: ShengHuo ZHU @ 2001-07-25 22:19 UTC (permalink / raw)


Danny Siu <dsiu@Adobe.COM> writes:

> If threading is turned off (T T in summary buffer) and %B is used in
> g-s-line-format, an extra gnus-sum-thread-tree-single-leaf "\-> " would be
> inserted.  I have attached a patch to fixed this.  It is a diff against the
> latest (7/24/01 5pm) CVS.
> 
> Can someone who has write access commit the patch?

Installed. Thanks.

ShengHuo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Patch for Summary thread tree using "%B"
  2001-07-23 23:50 Patch for Summary thread tree using "%B" Karl Kleinpaste
                   ` (2 preceding siblings ...)
  2001-07-25 21:46 ` [Patch] " Danny Siu
@ 2001-07-27 22:35 ` Kai Großjohann
  3 siblings, 0 replies; 8+ messages in thread
From: Kai Großjohann @ 2001-07-27 22:35 UTC (permalink / raw)
  Cc: ding

On Mon, 23 Jul 2001, Karl Kleinpaste wrote:

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

This is very nifty.  Of course, you realize that once we have this
textual tree, we want the full monty!

Does anybody have an idea how to extend this to insert little graphics
with the appropriate lines into the buffer?

Is it possible to insert images into a string, such that inserting the
string into the buffer automatically inserts the image?

How to find out font size so that the images have the right height?
(I figure the width is not so critical; it just has to be the same for
all the images.)

Thoughts?

kai
-- 
~/.signature: No such file or directory


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-07-27 22:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-23 23:50 Patch for Summary thread tree using "%B" Karl Kleinpaste
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

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