Commit 4fba3b2c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Info-insert-dir): Detect and report problems

in input files, such as "No Top node".  Return with point
at the beginning of the text.
(Info-find-node): Reinsert the code to handle files
with no tags table; it was deleted by mistake.
parent d5792fb2
......@@ -512,8 +512,18 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(throw 'foo t)))))
"No such anchor in tag table or node in tag table or file: %s"
(goto-char (max (point-min) (- guesspos 1000)))
;; Now search from our advised position (or from beg of buffer)
;; to find the actual node.
(catch 'foo
(while (search-forward "\n\^_" nil t)
(forward-line 1)
(let ((beg (point)))
(forward-line 1)
(if (re-search-backward regexp beg t)
(throw 'foo t))))
(error "No such node: %s" nodename))))
(goto-char (point-min))))
;; If we did not finish finding the specified node,
......@@ -536,6 +546,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
;; constructed Info-dir-contents.
(defvar Info-dir-file-attributes nil)
(defvar Info-dir-file-name nil)
;; Construct the Info directory node by merging the files named `dir'
;; from various directories. Set the *info* buffer's
;; default-directory to the first directory we actually get any text
......@@ -552,10 +564,14 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(setcar (nthcdr 4 (cdr elt)) 0)
(equal (cdr elt) curr)))
(insert Info-dir-contents)
(insert Info-dir-contents)
(goto-char (point-min)))
(let ((dirs Info-directory-list)
;; Bind this in case the user sets it to nil.
(case-fold-search t)
;; This is set non-nil if we find a problem in some input files.
buffers buffer others nodes dirs-done)
(setq Info-dir-file-attributes nil)
......@@ -590,6 +606,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(condition-case nil
(insert-file-contents file)
(make-local-variable 'Info-dir-file-name)
(setq Info-dir-file-name file)
(setq buffers (cons (current-buffer) buffers)
(cons (cons file attrs)
......@@ -614,7 +632,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
;; Look at each of the other buffers one by one.
(while others
(let ((other (car others)))
(let ((other (car others))
;; In each, find all the menus.
(set-buffer other)
......@@ -630,7 +649,13 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(search-forward "\n\^_" nil 'move)
(setq end (point))
(setq nodes (cons (list nodename other beg end) nodes))))))
(setq this-buffer-nodes
(cons (list nodename other beg end)
(if (assoc-ignore-case "top" this-buffer-nodes)
(setq nodes (nconc this-buffer-nodes nodes))
(setq problems t)
(message "No `top' node in %s" Info-dir-file-name))))
(setq others (cdr others)))
;; Add to the main menu a menu item for each other node.
(re-search-forward "^\\* Menu:")
......@@ -676,7 +701,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(while buffers
(kill-buffer (car buffers))
(setq buffers (cdr buffers)))
(message "Composing main Info directory...done"))
(goto-char (point-min))
(if problems
(message "Composing main Info directory...problems encountered, see `*Messages*'")
(message "Composing main Info directory...done")))
(setq Info-dir-contents (buffer-string)))
(setq default-directory Info-dir-contents-directory))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment