Function: mh-thread-generate-scan-lines
mh-thread-generate-scan-lines is a byte-compiled function defined in
mh-thread.el.gz.
Signature
(mh-thread-generate-scan-lines TREE LEVEL)
Documentation
Generate scan lines.
TREE is the hierarchical tree of messages, SCAN-LINE-MAP maps message indices to the corresponding scan lines and LEVEL used to determine indentation of the message.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-thread.el.gz
(defun mh-thread-generate-scan-lines (tree level)
"Generate scan lines.
TREE is the hierarchical tree of messages, SCAN-LINE-MAP maps
message indices to the corresponding scan lines and LEVEL used to
determine indentation of the message."
(cond ((null tree) nil)
((mh-thread-container-p tree)
(let* ((message (mh-container-message tree))
(id (mh-message-id message))
(index (gethash id mh-thread-id-index-map))
(duplicates (gethash id mh-thread-duplicates))
(new-level (+ level 2))
(dupl-flag t)
(force-angle-flag nil)
(increment-level-flag nil))
(dolist (scan-line (mapcar (lambda (x)
(gethash x mh-thread-scan-line-map))
(reverse (cons index duplicates))))
(when scan-line
(when (and dupl-flag (equal level 0)
(mh-thread-ancestor-p mh-thread-last-ancestor tree))
(setq level (+ level 2)
new-level (+ new-level 2)
force-angle-flag t))
(when (equal level 0)
(setq mh-thread-last-ancestor tree)
(while (mh-container-parent mh-thread-last-ancestor)
(setq mh-thread-last-ancestor
(mh-container-parent mh-thread-last-ancestor))))
(let* ((lev (if dupl-flag level new-level))
(square-flag (or (and (mh-container-real-child-p tree)
(not force-angle-flag)
dupl-flag)
(equal lev 0))))
(insert (car scan-line)
(format (format "%%%ss" lev) "")
(if square-flag "[" "<")
(cadr scan-line)
(if square-flag "]" ">")
(truncate-string-to-width
(caddr scan-line) (- mh-thread-body-width lev))
"\n"))
(setq increment-level-flag t)
(setq dupl-flag nil)))
(unless increment-level-flag (setq new-level level))
(dolist (child (mh-container-children tree))
(mh-thread-generate-scan-lines child new-level))))
(t (let ((nlevel (+ level 2)))
(dolist (ch tree)
(mh-thread-generate-scan-lines ch nlevel))))))