Function: kfile:read-v4-or-v3

kfile:read-v4-or-v3 is a byte-compiled function defined in kfile.el.

Signature

(kfile:read-v4-or-v3 BUFFER V3-FLAG)

Documentation

Create a koutline view by reading version-4 BUFFER. Return the new view.

If V3-FLAG is true, read as a version-3 buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kfile.el
(defun kfile:read-v4-or-v3 (buffer v3-flag)
  "Create a koutline view by reading version-4 BUFFER.  Return the new view.
If V3-FLAG is true, read as a version-3 buffer."
  (let ((standard-input buffer)
	cell-count label-type label-min-width label-separator
	level-indent cell-data top-cell-attributes view)
    (widen)
    (goto-char (point-min))
    ;; Skip past cell contents here.
    (search-forward "\n\^_" nil t 2)
    ;; Read rest of file data.
    (unless v3-flag ;; V3 files did not store viewspecs.
      (kvspec:initialize)
      (setq kvspec:current (read)))
    (setq cell-count (read)
	  label-type (read)
	  label-min-width (read)
	  label-separator (read)
	  level-indent (read)
	  cell-data (read))
    ;;
    (setq top-cell-attributes (aref (aref cell-data 0) 1)
	  view (kview:create (buffer-name buffer) cell-count top-cell-attributes
			     label-type level-indent label-separator label-min-width))
    ;;
    (kfile:narrow-to-kcells)
    (goto-char (point-min))
    ;;
    ;; Add attributes to cells.
    (kfile:insert-attributes-v3 view cell-data)
    ;;
    ;; Mark view unmodified and move to first cell.
    (set-buffer-modified-p nil)
    (goto-char (point-min))
    (goto-char (kcell-view:start))
    view))