Function: ebrowse-read

ebrowse-read is a byte-compiled function defined in ebrowse.el.gz.

Signature

(ebrowse-read)

Documentation

Read ebrowse-hs and ebrowse-ts structures in the current buffer.

Return a list (HEADER TREE) where HEADER is the file header read and TREE is a list of ebrowse-ts structures forming the class tree.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ebrowse.el.gz
;;; Reading a tree from disk

(defun ebrowse-read ()
  "Read `ebrowse-hs' and `ebrowse-ts' structures in the current buffer.
Return a list (HEADER TREE) where HEADER is the file header read
and TREE is a list of `ebrowse-ts' structures forming the class tree."
  (let ((header (condition-case nil
		    (read (current-buffer))
		  (error (error "No Ebrowse file header found"))))
	tree)
    ;; Check file format.
    (unless (ebrowse-hs-p header)
      (error "No Ebrowse file header found"))
    (unless (string= (ebrowse-hs-version header) ebrowse-version-string)
      (error "File has wrong version `%s' (`%s' expected)"
	     (ebrowse-hs-version header) ebrowse-version-string))
    ;; Read Lisp objects.  Temporarily increase `gc-cons-threshold' to
    ;; prevent a GC that would not free any memory.
    (let ((gc-cons-threshold (max gc-cons-threshold 2000000)))
      (while (not (progn (skip-chars-forward " \t\n") (eobp)))
	(let* ((root (read (current-buffer)))
	       (old-root-ptr (ebrowse-class-in-tree root tree)))
	  (ebrowse-show-progress "Reading data" (null tree))
	  (if old-root-ptr
	      (setcar old-root-ptr root)
	    (push root tree)))))
    (garbage-collect)
    (list header tree)))