From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/31422 Path: main.gmane.org!not-for-mail From: tlilja@cs.hut.fi (Timo Lilja) Newsgroups: gmane.emacs.gnus.general Subject: [gnu.emacs.gnus] Re: is there a way to have a thread tree like in tin? Date: 15 Jun 2000 10:17:11 +0300 Sender: owner-ding@hpc.uh.edu Message-ID: <85u2evquq0.fsf@lambda.cs.hut.fi> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035167834 13938 80.91.224.250 (21 Oct 2002 02:37:14 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 02:37:14 +0000 (UTC) Return-Path: Original-Received: from karazm.math.uh.edu (karazm.math.uh.edu [129.7.128.1]) by mailhost.sclp.com (Postfix) with ESMTP id C3F78D051F for ; Thu, 15 Jun 2000 03:21:33 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by karazm.math.uh.edu (8.9.3/8.9.3) with ESMTP id CAC26733; Thu, 15 Jun 2000 02:17:59 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Thu, 15 Jun 2000 02:17:04 -0500 (CDT) Original-Received: from mailhost.sclp.com (postfix@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id CAA28983 for ; Thu, 15 Jun 2000 02:16:53 -0500 (CDT) Original-Received: from hutcs.cs.hut.fi (hutcs.cs.hut.fi [130.233.192.7]) by mailhost.sclp.com (Postfix) with ESMTP id EDCD5D051F for ; Thu, 15 Jun 2000 03:17:17 -0400 (EDT) Original-Received: from lambda.cs.hut.fi (lambda [130.233.192.205]) by hutcs.cs.hut.fi (8.9.3/8.9.3) with ESMTP id KAA19807 for ; Thu, 15 Jun 2000 10:17:17 +0300 (EET DST) Original-Received: from tlilja by lambda.cs.hut.fi with local (Exim 3.12 #1 (Debian)) id 132Ttn-00037E-00 for ; Thu, 15 Jun 2000 10:17:11 +0300 Original-To: ding@gnus.org Original-Lines: 55 User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.6 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:31422 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:31422 --=-=-= I posted this to gnu.emacs.gnus and somebody suggested that I should post it to this mailing list: rjs@lloke.dna.fi (Riku Saikkonen) writes: >I'll try to implement the thread tree, if I get the time. We'll see... >Don't hold your breath. Okay, here is a patch for gnus-sum.el that me and Riku wrote. (gnus-sum.el is located in /usr/share/emacs/site-lisp/gnus/gnus-sum.el atleast in my Debian system.) Copy the original gnus-sum.el to a local directory, say ~/elisp and patch (1) it. Following elisp-spells have to be added into your local Gnus configuration file (~/.gnus): (load "~/elisp/gnus-sum.el") (setq gnus-summary-line-format "%U%R%z%(%[%4L: %-20,20f%]%) %B%s\n") ;; Dummy roots to threads (setq gnus-summary-make-false-root 'dummy) (setq gnus-summary-dummy-line-format " %(: :%) %-10S\n") It's not necessary to use dummy thread roots but I think they make the the summary buffer easier to read. After restarting Gnus the Summary buffer should look something like this: : : Re: is there a way to have a thread t$ [ 15: Miernik ] +-> [ 16: Riku Saikkonen ] | \-> [ 35: Miernik ] \-> [ 49: Nuutti Kotivuori ] \-> You can customize this thread tree display somewhat. There are some variables defined in the patched gnus-sum.el. What the patch does is that it adds a new format specification character B in the accepted format specifications in 'gnus-summary-line-format' variable. Note that I've tried this patch with Gnus version 5.8.3 only. I have no idea, whether this patch works in any other Gnus version. (Probably not, though ;) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-sum.el.diff --- /usr/share/emacs/site-lisp/gnus/gnus-sum.el Wed Jan 26 01:23:18 2000 +++ gnus-sum.el Tue Jun 13 21:23:40 2000 @@ -941,11 +941,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 +3770,16 @@ (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header)))) "")) +;; Not sure, whether this is the right place to put these variables. +(defvar gnus-tmp-thread-tree-header-string nil) + +(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)))) @@ -3929,7 +3943,7 @@ (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 +4004,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 (or (cdar thread) (not (nth 1 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 +4035,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! --=-=-=--