Function: hierarchy-tabulated-display

hierarchy-tabulated-display is a byte-compiled function defined in hierarchy.el.gz.

Signature

(hierarchy-tabulated-display HIERARCHY LABELFN &optional BUFFER)

Documentation

Display HIERARCHY as a tabulated list in hierarchy-tabulated-mode.

LABELFN is a function taking an item of HIERARCHY and an indentation level (a number) as input and inserting a string to be displayed in the table.

The tabulated list is displayed in BUFFER, or a newly created buffer if nil. The buffer is returned.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/hierarchy.el.gz
(defun hierarchy-tabulated-display (hierarchy labelfn &optional buffer)
  "Display HIERARCHY as a tabulated list in `hierarchy-tabulated-mode'.

LABELFN is a function taking an item of HIERARCHY and an indentation
level (a number) as input and inserting a string to be displayed in the
table.

The tabulated list is displayed in BUFFER, or a newly created buffer if
nil.  The buffer is returned."
  (let ((buffer (or buffer (generate-new-buffer "hierarchy-tabulated"))))
    (with-current-buffer buffer
      (hierarchy-tabulated-mode)
      (setq tabulated-list-format
            (vector '("Item name" 0 nil)))
      (setq tabulated-list-entries
            (hierarchy-map (lambda (item indent)
                             (list item (vector (hierarchy-labelfn-to-string
                                                 labelfn item indent))))
                           hierarchy))
      (tabulated-list-init-header)
      (tabulated-list-print))
    buffer))