Function: gnus-generate-horizontal-tree

gnus-generate-horizontal-tree is a byte-compiled function defined in gnus-salt.el.gz.

Signature

(gnus-generate-horizontal-tree THREAD LEVEL &optional DUMMYP ADOPTED)

Documentation

Generate a horizontal tree.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-salt.el.gz
(defun gnus-generate-horizontal-tree (thread level &optional dummyp adopted)
  "Generate a horizontal tree."
  (let* ((dummy (stringp (car thread)))
	 (do (or dummy
		 (and (car thread)
		      (memq (mail-header-number (car thread))
			    gnus-tmp-limit))))
	 col beg)
    (if (not do)
	;; We don't want this article.
	(setq thread (cdr thread))
      (if (not (bolp))
	  ;; Not the first article on the line, so we insert a "-".
	  (insert (car gnus-tree-parent-child-edges))
	;; If the level isn't zero, then we insert some indentation.
	(unless (zerop level)
	  (gnus-tree-indent level)
	  (insert (cadr gnus-tree-parent-child-edges))
          (setq col (- (setq beg (point)) (line-beginning-position) 1))
	  ;; Draw "|" lines upwards.
	  (while (progn
		   (forward-line -1)
		   (forward-char col)
		   (eq (char-after) ? ))
	    (delete-char 1)
	    (insert (caddr gnus-tree-parent-child-edges)))
	  (goto-char beg)))
      (setq dummyp nil)
      ;; Insert the article node.
      (gnus-tree-node-insert (pop thread) gnus-tmp-sparse adopted))
    (if (null thread)
	;; End of the thread, so we go to the next line.
	(unless (bolp)
	  (insert "\n"))
      ;; Recurse downwards in all children of this article.
      (while thread
	(gnus-generate-horizontal-tree
	 (pop thread) (if do (1+ level) level)
	 (or dummyp dummy) dummy)))))