- ;; Find nodes with index cookie
- (let* ((default-directory (or (and (stringp file)
- (file-name-directory
- (setq file (Info-find-file file))))
- default-directory))
- Info-history Info-history-list Info-fontify-maximum-menu-size
- (main-file file) subfiles nodes node)
- (condition-case nil
- (with-temp-buffer
- (while (or main-file subfiles)
- (erase-buffer)
- (info-insert-file-contents (or main-file (car subfiles)))
- (goto-char (point-min))
- (while (search-forward "\0\b[index\0\b]" nil 'move)
- (save-excursion
- (re-search-backward "^\^_")
- (search-forward "Node: ")
- (setq nodes (cons (Info-following-node-name) nodes))))
- (if main-file
- (save-excursion
- (goto-char (point-min))
- (if (search-forward "\n\^_\nIndirect:" nil t)
- (let ((bound (save-excursion (search-forward "\n\^_" nil t))))
- (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)
- (setq subfiles (cons (match-string-no-properties 1)
- subfiles)))))
- (setq subfiles (nreverse subfiles)
- main-file nil))
- (setq subfiles (cdr subfiles)))))
- (error nil))
- (if nodes
- (setq nodes (nreverse nodes)
- Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
- nodes)
- ;; Find nodes with the word "Index" in the node name
- (let ((case-fold-search t)
- Info-history Info-history-list Info-fontify-maximum-menu-size
- nodes node)
- (condition-case nil
- (with-temp-buffer
- (Info-mode)
- (Info-find-node file "Top")
- (when (and (search-forward "\n* menu:" nil t)
- (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
- (goto-char (match-beginning 1))
- (setq nodes (list (Info-extract-menu-node-name)))
- (Info-goto-node (car nodes))
- (while (and (setq node (Info-extract-pointer "next" t))
- (string-match "\\<Index\\>" node))
- (setq nodes (cons node nodes))
- (Info-goto-node node))))
- (error nil))
- (if nodes
- (setq nodes (nreverse nodes)
- Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
- nodes)
+ (if Info-file-supports-index-cookies
+ ;; Find nodes with index cookie
+ (let* ((default-directory (or (and (stringp file)
+ (file-name-directory
+ (setq file (Info-find-file file))))
+ default-directory))
+ Info-history Info-history-list Info-fontify-maximum-menu-size
+ (main-file file) subfiles nodes node)
+ (condition-case nil
+ (with-temp-buffer
+ (while (or main-file subfiles)
+ (erase-buffer)
+ (info-insert-file-contents (or main-file (car subfiles)))
+ (goto-char (point-min))
+ (while (search-forward "\0\b[index\0\b]" nil 'move)
+ (save-excursion
+ (re-search-backward "^\^_")
+ (search-forward "Node: ")
+ (setq nodes (cons (Info-following-node-name) nodes))))
+ (if main-file
+ (save-excursion
+ (goto-char (point-min))
+ (if (search-forward "\n\^_\nIndirect:" nil t)
+ (let ((bound (save-excursion (search-forward "\n\^_" nil t))))
+ (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)
+ (setq subfiles (cons (match-string-no-properties 1)
+ subfiles)))))
+ (setq subfiles (nreverse subfiles)
+ main-file nil))
+ (setq subfiles (cdr subfiles)))))
+ (error nil))
+ (if nodes
+ (setq nodes (nreverse nodes)
+ Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
+ nodes)
+ ;; Else find nodes with the word "Index" in the node name
+ (let ((case-fold-search t)
+ Info-history Info-history-list Info-fontify-maximum-menu-size
+ nodes node)
+ (condition-case nil
+ (with-temp-buffer
+ (Info-mode)
+ (Info-find-node file "Top")
+ (when (and (search-forward "\n* menu:" nil t)
+ (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
+ (goto-char (match-beginning 1))
+ (setq nodes (list (Info-extract-menu-node-name)))
+ (Info-goto-node (car nodes))
+ (while (and (setq node (Info-extract-pointer "next" t))
+ (string-match "\\<Index\\>" node))
+ (setq nodes (cons node nodes))
+ (Info-goto-node node))))
+ (error nil))
+ (if nodes
+ (setq nodes (nreverse nodes)
+ Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
+ nodes))