Function: kfile:build-structure-v2

kfile:build-structure-v2 is a byte-compiled function defined in kfile.el.

Signature

(kfile:build-structure-v2 KOTL-STRUCTURE CELL-DATA)

Documentation

Build cell list from the KOTL-STRUCTURE and its CELL-DATA.

Assume all arguments are valid. CELL-DATA is a vector of cell fields read from a koutline file.

Return list of outline cells in depth first order. Invisible top cell is not included in the list.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kfile.el
;;; ************************************************************************
;;; Private functions
;;; ************************************************************************

(defun kfile:build-structure-v2 (kotl-structure cell-data)
  "Build cell list from the KOTL-STRUCTURE and its CELL-DATA.
Assume all arguments are valid.  CELL-DATA is a vector of cell fields read
from a koutline file.

Return list of outline cells in depth first order.  Invisible top cell is not
included in the list."
  (let ((stack) (sibling-p) (cell-list) func cell)
    (mapc
     (lambda (item)
       (setq func (cdr (assoc item
			      (list
			       (cons "\("
				     (lambda ()
				       (setq stack (cons sibling-p stack)
					     sibling-p nil)))
			       (cons "\)"
				     (lambda ()
				       (setq sibling-p (car stack)
					     stack (cdr stack))))))))
       (cond (func (funcall func))
	     ;; 0th cell was created with kview:create.
	     ((equal item 0) nil)
	     (t (setq cell (kcell-data:to-kcell-v2 (aref cell-data item))
		      cell-list (cons cell cell-list)
		      sibling-p t))))
     kotl-structure)
    (nreverse cell-list)))