Function: cvs-tree-print
cvs-tree-print is a byte-compiled function defined in
cvs-status.el.gz.
Signature
(cvs-tree-print TAGS PRINTER COLUMN)
Documentation
Print the tree of TAGS where each tag's string is given by PRINTER.
PRINTER should accept both a tag (in which case it should return a string) or a string (in which case it should simply return its argument). A tag cannot be a CONS. The return value can also be a list of strings, if several nodes where merged into one. The tree will be printed no closer than column COLUMN.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/cvs-status.el.gz
(defun cvs-tree-print (tags printer column)
"Print the tree of TAGS where each tag's string is given by PRINTER.
PRINTER should accept both a tag (in which case it should return a string)
or a string (in which case it should simply return its argument).
A tag cannot be a CONS. The return value can also be a list of strings,
if several nodes where merged into one.
The tree will be printed no closer than column COLUMN."
(let* ((eol (save-excursion (end-of-line) (current-column)))
(column (max (+ eol 2) column)))
(if (null tags) column
(let* ((rev (cvs-car tags))
(name (funcall printer (cvs-car rev)))
(rest (append (cvs-cdr name) (cvs-cdr tags)))
(prefix
(save-excursion
(or (= (forward-line 1) 0) (insert "\n"))
(cvs-tree-print rest printer column))))
(cl-assert (>= prefix column))
(move-to-column prefix t)
(cl-assert (eolp))
(insert (cvs-car name))
(dolist (br (cvs-cdr rev))
(let* ((column (current-column))
(brrev (funcall printer (cvs-car br)))
(brlength (length (cvs-car brrev)))
(brfill (concat (make-string (/ brlength 2) ? ) "|"))
(prefix
(save-excursion
(insert " -- ")
(cvs-tree-print (cvs-append brrev brfill (cvs-cdr br))
printer (current-column)))))
(delete-region (save-excursion (move-to-column prefix) (point))
(point))
(insert " " (make-string (- prefix column 2) ?-) " ")
(end-of-line)))
prefix))))