aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-10-11 22:44:46 +0000
committerRichard M. Stallman1998-10-11 22:44:46 +0000
commit4fba3b2c067e2665e38b9557eb230cefcbb33235 (patch)
tree3271b8a5a3d96fa3eb81f494c4e07c600ecdc15d
parentd5792fb2eb6bed6df37eb46547f3c8df3b464b36 (diff)
downloademacs-4fba3b2c067e2665e38b9557eb230cefcbb33235.tar.gz
emacs-4fba3b2c067e2665e38b9557eb230cefcbb33235.zip
(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.
-rw-r--r--lisp/info.el40
1 files changed, 34 insertions, 6 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 6149c570b14..28ce27525f8 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -512,8 +512,18 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
512 (throw 'foo t))))) 512 (throw 'foo t)))))
513 (error 513 (error
514 "No such anchor in tag table or node in tag table or file: %s" 514 "No such anchor in tag table or node in tag table or file: %s"
515 nodename)))))) 515 nodename))))
516 516 (goto-char (max (point-min) (- guesspos 1000)))
517 ;; Now search from our advised position (or from beg of buffer)
518 ;; to find the actual node.
519 (catch 'foo
520 (while (search-forward "\n\^_" nil t)
521 (forward-line 1)
522 (let ((beg (point)))
523 (forward-line 1)
524 (if (re-search-backward regexp beg t)
525 (throw 'foo t))))
526 (error "No such node: %s" nodename))))
517 (Info-select-node) 527 (Info-select-node)
518 (goto-char (point-min)))) 528 (goto-char (point-min))))
519 ;; If we did not finish finding the specified node, 529 ;; If we did not finish finding the specified node,
@@ -536,6 +546,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
536;; constructed Info-dir-contents. 546;; constructed Info-dir-contents.
537(defvar Info-dir-file-attributes nil) 547(defvar Info-dir-file-attributes nil)
538 548
549(defvar Info-dir-file-name nil)
550
539;; Construct the Info directory node by merging the files named `dir' 551;; Construct the Info directory node by merging the files named `dir'
540;; from various directories. Set the *info* buffer's 552;; from various directories. Set the *info* buffer's
541;; default-directory to the first directory we actually get any text 553;; 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."
552 (setcar (nthcdr 4 (cdr elt)) 0) 564 (setcar (nthcdr 4 (cdr elt)) 0)
553 (equal (cdr elt) curr))) 565 (equal (cdr elt) curr)))
554 Info-dir-file-attributes)))) 566 Info-dir-file-attributes))))
555 (insert Info-dir-contents) 567 (progn
568 (insert Info-dir-contents)
569 (goto-char (point-min)))
556 (let ((dirs Info-directory-list) 570 (let ((dirs Info-directory-list)
557 ;; Bind this in case the user sets it to nil. 571 ;; Bind this in case the user sets it to nil.
558 (case-fold-search t) 572 (case-fold-search t)
573 ;; This is set non-nil if we find a problem in some input files.
574 problems
559 buffers buffer others nodes dirs-done) 575 buffers buffer others nodes dirs-done)
560 576
561 (setq Info-dir-file-attributes nil) 577 (setq Info-dir-file-attributes nil)
@@ -590,6 +606,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
590 (condition-case nil 606 (condition-case nil
591 (progn 607 (progn
592 (insert-file-contents file) 608 (insert-file-contents file)
609 (make-local-variable 'Info-dir-file-name)
610 (setq Info-dir-file-name file)
593 (setq buffers (cons (current-buffer) buffers) 611 (setq buffers (cons (current-buffer) buffers)
594 Info-dir-file-attributes 612 Info-dir-file-attributes
595 (cons (cons file attrs) 613 (cons (cons file attrs)
@@ -614,7 +632,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
614 632
615 ;; Look at each of the other buffers one by one. 633 ;; Look at each of the other buffers one by one.
616 (while others 634 (while others
617 (let ((other (car others))) 635 (let ((other (car others))
636 this-buffer-nodes)
618 ;; In each, find all the menus. 637 ;; In each, find all the menus.
619 (save-excursion 638 (save-excursion
620 (set-buffer other) 639 (set-buffer other)
@@ -630,7 +649,13 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
630 (search-forward "\n\^_" nil 'move) 649 (search-forward "\n\^_" nil 'move)
631 (beginning-of-line) 650 (beginning-of-line)
632 (setq end (point)) 651 (setq end (point))
633 (setq nodes (cons (list nodename other beg end) nodes)))))) 652 (setq this-buffer-nodes
653 (cons (list nodename other beg end)
654 this-buffer-nodes))))
655 (if (assoc-ignore-case "top" this-buffer-nodes)
656 (setq nodes (nconc this-buffer-nodes nodes))
657 (setq problems t)
658 (message "No `top' node in %s" Info-dir-file-name))))
634 (setq others (cdr others))) 659 (setq others (cdr others)))
635 ;; Add to the main menu a menu item for each other node. 660 ;; Add to the main menu a menu item for each other node.
636 (re-search-forward "^\\* Menu:") 661 (re-search-forward "^\\* Menu:")
@@ -676,7 +701,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
676 (while buffers 701 (while buffers
677 (kill-buffer (car buffers)) 702 (kill-buffer (car buffers))
678 (setq buffers (cdr buffers))) 703 (setq buffers (cdr buffers)))
679 (message "Composing main Info directory...done")) 704 (goto-char (point-min))
705 (if problems
706 (message "Composing main Info directory...problems encountered, see `*Messages*'")
707 (message "Composing main Info directory...done")))
680 (setq Info-dir-contents (buffer-string))) 708 (setq Info-dir-contents (buffer-string)))
681 (setq default-directory Info-dir-contents-directory)) 709 (setq default-directory Info-dir-contents-directory))
682 710