+
+(defvar Info-toc-nodes nil
+ "Alist of cached parent-children node information in visited Info files.
+Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...)
+where PARENT is the parent node extracted from the Up pointer,
+SECTION is the section name in the Top node where this node is placed,
+CHILDREN is a list of child nodes extracted from the node menu.")
+
+(defun Info-toc-nodes (file)
+ "Return a node list of Info FILE with parent-children information.
+This information is cached in the variable `Info-toc-nodes' with the help
+of the function `Info-build-toc'."
+ (or file (setq file Info-current-file))
+ (or (assoc file Info-toc-nodes)
+ ;; Skip virtual Info files
+ (and (or (not (stringp file))
+ (member file '("dir" apropos history toc)))
+ (push (cons file nil) Info-toc-nodes))
+ ;; Scan the entire manual and cache the result in Info-toc-nodes
+ (let ((nodes (Info-build-toc file)))
+ (push (cons file nodes) Info-toc-nodes)
+ nodes)
+ ;; If there is an error, still add nil to the cache
+ (push (cons file nil) Info-toc-nodes))
+ (cdr (assoc file Info-toc-nodes)))
+