]> code.delx.au - gnu-emacs/blobdiff - lisp/info.el
Use the correct capitalization when making Info-mode and Info-edit-mode
[gnu-emacs] / lisp / info.el
index c48e2800cf3a9085328d4cb74febd15048a3f896..841e699cf34184e18f5972b4f1750ec7491b66a2 100644 (file)
@@ -1,6 +1,6 @@
 ;;; info.el --- info package for Emacs.
 
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99 Free Software
+;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -61,37 +61,68 @@ The Lisp code is executed when the node is selected.")
   :group 'info)
 
 (defface info-node
-  '((t (:bold t :italic t)))
+  '((((class color) (background light)) (:foreground "brown" :bold t :italic t))
+    (((class color) (background dark)) (:foreground "white" :bold t :italic t))
+    (t (:bold t :italic t)))
   "Face for Info node names."
   :group 'info)
 
 (defface info-menu-5
-  '((t (:underline t)))
+  '((((class color)) (:foreground "red1"))
+    (t (:underline t)))
   "Face for the fifth and tenth `*' in an Info menu."
   :group 'info)
 
 (defface info-xref
-  '((t (:bold t)))
+  '((((class color) (background light)) (:foreground "magenta4" :bold t))
+    (((class color) (background dark)) (:foreground "cyan" :bold t))
+    (t (:bold t)))
   "Face for Info cross-references."
   :group 'info)
 
-(defcustom Info-fontify-maximum-menu-size 30000
+(defcustom Info-fontify-maximum-menu-size 100000
   "*Maximum size of menu to fontify if `Info-fontify' is non-nil."
   :type 'integer
   :group 'info)
 
+(defcustom Info-use-header-line t
+  "*Non-nil means to put the beginning-of-node links in an emacs header-line.
+A header-line does not scroll with the rest of the buffer."
+  :type 'boolean
+  :group 'info)
+
+(defface info-header-xref
+  '((t (:inherit info-xref)))
+  "Face for Info cross-references in a node header."
+  :group 'info)
+
+(defface info-header-node
+  '(;; Because header-lines on tty's are usually reverse-video, the
+    ;; normal info-node colors probably won't look good, so just stick
+    ;; with bold-italic
+    (((type tty) (class color)) (:bold t :italic t))
+    (t (:inherit info-node)))
+  "Face for Info nodes in a node header."
+  :group 'info)
+
 (defvar Info-directory-list nil
   "List of directories to search for Info documentation files.
 nil means not yet initialized.  In this case, Info uses the environment
 variable INFOPATH to initialize it, or `Info-default-directory-list'
 if there is no INFOPATH variable in the environment.
-The last element of `Info-default-directory-list' is the directory
-where Emacs installs the Info files that come with it.
+
+When `Info-directory-list' is initialized from the value of
+`Info-default-directory-list', the first element of the resulting
+list is the directory where Emacs installs the Info files that
+come with it.  This is so that Emacs's own manual, which suits the
+version of Emacs you are using, will always be found first.  (If
+you want to override that, set INFOPATH in the environment.)
 
 If you run the Emacs executable from the `src' directory in the Emacs
-source tree, the `info' directory in the source tree is used as the last
-element, in place of the installation Info directory.  This is useful
-when you run a version of Emacs without installing it.")
+source tree, and INFOPATH is not defined, the `info' directory in the
+source tree is used as the first element of `Info-directory-list', in
+place of the installation Info directory.  This is useful when you run
+a version of Emacs without installing it.")
 
 (defcustom Info-additional-directory-list nil
   "List of additional directories to search for Info documentation files.
@@ -106,8 +137,8 @@ It doesn't contain directory names or file name extensions added by Info.
 Can also be t when using `Info-on-current-buffer'.")
 
 (defvar Info-current-subfile nil
-  "Info subfile that is actually in the *info* buffer now,
-or nil if current info file is not split into subfiles.")
+  "Info subfile that is actually in the *info* buffer now.
+nil if current info file is not split into subfiles.")
 
 (defvar Info-current-node nil
   "Name of node that Info is now looking at, or nil.")
@@ -123,7 +154,7 @@ Marker points nowhere if file has no tag table.")
   "Cached completion list for current Info file.")
 
 (defvar Info-index-alternatives nil
-  "List of possible matches for last Info-index command.")
+  "List of possible matches for last `Info-index' command.")
 
 (defvar Info-standalone nil
   "Non-nil if Emacs was started solely as an Info browser.")
@@ -247,8 +278,8 @@ Do the right thing if the file has been compressed or zipped."
            (call-process-region (point-min) (point-max) decoder t t)))
       (insert-file-contents fullname visit))))
 \f
-;; Initialize Info-directory-list, if that hasn't been done yet.
 (defun info-initialize ()
+  "Initialize `Info-directory-list', if that hasn't been done yet."
   (unless Info-directory-list
     (let ((path (getenv "INFOPATH"))
          (source (expand-file-name "info/" source-directory))
@@ -256,30 +287,31 @@ Do the right thing if the file has been compressed or zipped."
                       (expand-file-name "info/" installation-directory)))
          alternative)
       (setq Info-directory-list
-           (if path
-               (split-string path (regexp-quote path-separator))
-             (if (and sibling (file-exists-p sibling))
-                 ;; Uninstalled, Emacs builddir != srcdir.
-                 (setq alternative sibling)
-               ;; Uninstalled, builddir == srcdir
-               (setq alternative source))
-             (if (or (member alternative Info-default-directory-list)
-                     ;; On DOS/NT, we use movable executables always,
-                     ;; and we must always find the Info dir at run time.
-                     (if (memq system-type '(ms-dos windows-nt))
-                         nil
-                       ;; Use invocation-directory for Info
-                       ;; only if we used it for exec-directory also.
-                       (not (string= exec-directory
-                                     (expand-file-name "lib-src/"
-                                                       installation-directory))))
-                     (not (file-exists-p alternative)))
-                 Info-default-directory-list
-               ;; `alternative' contains the Info files that came with this
-               ;; version, so we should look there first.  `Info-insert-dir'
-               ;; currently expects to find `alternative' first on the list.
-               (cons alternative
-                     (reverse (cdr (reverse Info-default-directory-list))))))))))
+           (prune-directory-list
+            (if path
+                (split-string path (regexp-quote path-separator))
+              (if (and sibling (file-exists-p sibling))
+                  ;; Uninstalled, Emacs builddir != srcdir.
+                  (setq alternative sibling)
+                ;; Uninstalled, builddir == srcdir
+                (setq alternative source))
+              (if (or (member alternative Info-default-directory-list)
+                      ;; On DOS/NT, we use movable executables always,
+                      ;; and we must always find the Info dir at run time.
+                      (if (memq system-type '(ms-dos windows-nt))
+                          nil
+                        ;; Use invocation-directory for Info
+                        ;; only if we used it for exec-directory also.
+                        (not (string= exec-directory
+                                      (expand-file-name "lib-src/"
+                                                        installation-directory))))
+                      (not (file-exists-p alternative)))
+                  Info-default-directory-list
+                ;; `alternative' contains the Info files that came with this
+                ;; version, so we should look there first.  `Info-insert-dir'
+                ;; currently expects to find `alternative' first on the list.
+                (cons alternative
+                      (reverse (cdr (reverse Info-default-directory-list)))))))))))
 
 ;;;###autoload
 (defun info-other-window (&optional file)
@@ -288,7 +320,7 @@ Do the right thing if the file has been compressed or zipped."
                   (list (read-file-name "Info file name: " nil nil t))))
   (let (same-window-buffer-names)
     (info file)))
-  
+
 ;;;###autoload (add-hook 'same-window-buffer-names "*info*")
 
 ;;;###autoload
@@ -303,7 +335,7 @@ In interactive use, a prefix argument directs this command
 to read a file name from the minibuffer.
 
 The search path for Info files is in the variable `Info-directory-list'.
-The top-level Info directory is made by combining all the files named `dir' 
+The top-level Info directory is made by combining all the files named `dir'
 in all the directories in that path."
   (interactive (if current-prefix-arg
                   (list (read-file-name "Info file name: " nil nil t))))
@@ -351,18 +383,18 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
 ;; The return value is the value of point at the beginning of matching
 ;; REGERXP, if the function succeeds, nil otherwise.
 (defun Info-node-at-bob-matching (regexp)
-  (and (bobp)                  ; are we at beginning of buffer?
-       (looking-at "\^_")      ; does it begin with node delimiter?
+  (and (bobp)                          ; are we at beginning of buffer?
+       (looking-at "\^_")              ; does it begin with node delimiter?
        (let (beg)
         (forward-line 1)
         (setq beg (point))
-        (forward-line 1)       ; does the line after delimiter match REGEXP?
+        (forward-line 1)               ; does the line after delimiter match REGEXP?
         (re-search-backward regexp beg t))))
 
-;; Go to an info node specified as separate filename and nodename.
-;; no-going-back is non-nil if recovering from an error in this function;
-;; it says do not attempt further (recursive) error recovery.
 (defun Info-find-node (filename nodename &optional no-going-back)
+  "Go to an info node specified as separate FILENAME and NODENAME.
+NO-GOING-BACK is non-nil if recovering from an error in this function;
+it says do not attempt further (recursive) error recovery."
   (info-initialize)
   ;; Convert filename to lower case if not found as specified.
   ;; Expand it.
@@ -422,10 +454,81 @@ else defaults to `Top'."
             (completing-read "Node name: " (Info-build-node-completions)
                              nil t "Top")
           "Top")))
+  (info-initialize)
   (Info-mode)
   (set (make-local-variable 'Info-current-file) t)
   (Info-find-node-2 nil nodename))
 
+(defun Info-find-in-tag-table-1 (marker regexp case-fold)
+  "Find a node in a tag table.
+MARKER specifies the buffer and position to start searching at.
+REGEXP is a regular expression matching nodes or references.  Its first
+group should match `Node:' or `Ref:'.
+CASE-FOLD t means search for a case-insensitive match.
+If a match was found, value is a list (FOUND-ANCHOR POS MODE), where
+FOUND-ANCHOR is non-nil if a `Ref:' was matched, POS is the position
+where the match was found, and MODE is `major-mode' of the buffer in
+which the match was found."
+  (let ((case-fold-search case-fold)
+       found-mode guesspos found-anchor)
+    (save-excursion
+      (set-buffer (marker-buffer marker))
+      (goto-char marker)
+    
+      ;; Search tag table
+      (beginning-of-line)
+      (when (re-search-forward regexp nil t)
+       (list (string-equal "Ref:" (match-string 1))
+             (1+ (read (current-buffer)))
+             major-mode)))))
+
+(defun Info-find-in-tag-table (marker regexp)
+  "Find a node in a tag table.
+MARKER specifies the buffer and position to start searching at.
+REGEXP is a regular expression matching nodes or references.  Its first
+group should match `Node:' or `Ref:'.
+If a match was found, value is a list (FOUND-ANCHOR POS MODE), where
+FOUND-ANCHOR is non-nil if a `Ref:' was matched, POS is the position
+where the match was found, and MODE is `major-mode' of the buffer in
+which the match was found.
+This function tries to find a case-sensitive match first, then a
+case-insensitive match is tried."
+  (let ((result (Info-find-in-tag-table-1 marker regexp nil)))
+    (when (null (car result))
+      (setq result (Info-find-in-tag-table-1 marker regexp t)))
+    result))
+
+(defun Info-find-node-in-buffer-1 (regexp case-fold)
+  "Find a node or anchor in the current buffer.
+REGEXP is a regular expression matching nodes or references.  Its first
+group should match `Node:' or `Ref:'.
+CASE-FOLD t means search for a case-insensitive match.
+Value is the position at which a match was found, or nil if not found."
+  (let ((case-fold-search case-fold)
+       found)
+    (save-excursion
+      (when (Info-node-at-bob-matching regexp)
+       (setq found (point)))
+      (while (and (not found)
+                 (search-forward "\n\^_" nil t))
+       (forward-line 1)
+       (let ((beg (point)))
+         (forward-line 1)
+         (when (re-search-backward regexp beg t)
+           (beginning-of-line)
+           (setq found (point)))))
+      found)))
+                 
+(defun Info-find-node-in-buffer (regexp)
+  "Find a node or anchor in the current buffer.
+REGEXP is a regular expression matching nodes or references.  Its first
+group should match `Node:' or `Ref:'.
+Value is the position at which a match was found, or nil if not found.
+This function looks for a case-sensitive match first.  If none is found,
+a case-insensitive match is tried."
+  (or (Info-find-node-in-buffer-1 regexp nil)
+      (Info-find-node-in-buffer-1 regexp t)))
+  
 (defun Info-find-node-2 (filename nodename &optional no-going-back)
   (buffer-disable-undo (current-buffer))
   (or (eq major-mode 'Info-mode)
@@ -433,7 +536,6 @@ else defaults to `Top'."
   (widen)
   (setq Info-current-node nil)
   (unwind-protect
-      ;; Bind case-fold-search in case the user sets it to nil.
       (let ((case-fold-search t)
            anchorpos)
         ;; Switch files if necessary
@@ -501,112 +603,54 @@ else defaults to `Top'."
 
           ;; Search file for a suitable node.
          (let ((guesspos (point-min))
-               (regexp
-                (concat "\\(Node:\\|Ref:\\) *\\("
-                        (regexp-quote nodename)
-                        "\\) *[,\t\n\177]"))
+               (regexp (concat "\\(Node:\\|Ref:\\) *\\("
+                               (if (stringp nodename) 
+                                   (regexp-quote nodename)
+                                 "")
+                               "\\) *[,\t\n\177]"))
                (nodepos nil))
 
-            ;; First, search a tag table, if any
-            (if (marker-position Info-tag-table-marker)
-               (let ((found-in-tag-table t)
-                     found-anchor
-                     found-mode
-                     (m Info-tag-table-marker))
-                  (save-excursion
-                    (set-buffer (marker-buffer m))
-                    (goto-char m)
-                    (beginning-of-line) ; so re-search will work.
-
-                    ;; Search tag table
-                   (catch 'foo
-                     (while (re-search-forward regexp nil t)
-                       (setq found-anchor
-                             (string-equal "Ref:" (match-string 1)))
-                       (or nodepos (setq nodepos (point))
-                       (if (string-equal (match-string 2) nodename)
-                           (throw 'foo t))))
-                     (if nodepos
-                         (goto-char nodepos)
-                       (setq found-in-tag-table nil)))
-                    (if found-in-tag-table
-                        (setq guesspos (1+ (read (current-buffer)))))
-                    (setq found-mode major-mode))
-
-                  ;; Indirect file among split files
-                  (if found-in-tag-table
-                      (progn
-                        ;; If this is an indirect file, determine
-                        ;; which file really holds this node and
-                        ;; read it in.
-                        (if (not (eq found-mode 'Info-mode))
-                            ;; Note that the current buffer must be
-                            ;; the *info* buffer on entry to
-                            ;; Info-read-subfile.  Thus the hackery
-                            ;; above.
-                            (setq guesspos (Info-read-subfile guesspos)))))
-
-                  ;; Handle anchor
-                  (if found-anchor
+           (catch 'foo
+             
+             ;; First, search a tag table, if any
+             (when (marker-position Info-tag-table-marker)
+               (let* ((m Info-tag-table-marker)
+                      (found (Info-find-in-tag-table m regexp)))
+                 
+                 (when found
+                   ;; FOUND is (ANCHOR POS MODE).
+                   (setq guesspos (nth 1 found))
+                   
+                   ;; If this is an indirect file, determine which
+                   ;; file really holds this node and read it in.
+                   (unless (eq (nth 2 found) 'Info-mode)
+                     ;; Note that the current buffer must be the
+                     ;; *info* buffer on entry to
+                     ;; Info-read-subfile.  Thus the hackery above.
+                     (setq guesspos (Info-read-subfile guesspos)))
+
+                   ;; Handle anchor
+                   (when (nth 0 found)
                      (goto-char (setq anchorpos guesspos))
-
-                    ;; Else we may have a node, which we search for:
-                   (let ((guesschar
-                          (or (byte-to-position guesspos)
-                              (if (< (position-bytes (point-max)) guesspos)
-                                  (point-max)
-                                (point-min)))))
-                     (goto-char (max (point-min)
-                                     (- guesschar 1000))))
-                    ;; Now search from our advised position
-                    ;; (or from beg of buffer)
-                    ;; to find the actual node.
-                   ;; First, check whether the node is right
-                   ;; where we are, in case the buffer begins
-                   ;; with a node.
-                   (setq nodepos nil)
-                   (or (Info-node-at-bob-matching regexp)
-                       (catch 'foo
-                         (while (search-forward "\n\^_" nil t)
-                           (forward-line 1)
-                           (let ((beg (point)))
-                             (forward-line 1)
-                             (if (re-search-backward regexp beg t)
-                                 (if (string-equal (match-string 2) nodename)
-                                     (progn
-                                       (beginning-of-line)
-                                       (throw 'foo t))
-                                   (or nodepos
-                                     (setq nodepos (point)))))))
-                         (if nodepos
-                             (progn
-                               (goto-char nodepos)
-                               (beginning-of-line))
-                           (error
-                            "No such anchor in tag table or node in tag table or file: %s"
-                            nodename))))))
-             (goto-char (max (point-min) (- guesspos 1000)))
-             ;; Now search from our advised position (or from beg of buffer)
-             ;; to find the actual node.
-             ;; First, check whether the node is right where we are, in case
-             ;; the buffer begins with a node.
-             (setq nodepos nil)
-             (or (Info-node-at-bob-matching regexp)
-                 (catch 'foo
-                   (while (search-forward "\n\^_" nil t)
-                     (forward-line 1)
-                     (let ((beg (point)))
-                       (forward-line 1)
-                       (if (re-search-backward regexp beg t)
-                           (if (string-equal (match-string 2) nodename)
-                               (throw 'foo t)
-                             (or nodepos
-                                 (setq nodepos (point)))))))
-                   (if nodepos
-                       (goto-char nodepos)
-                     (error "No such node: %s" nodename))))))
-          (Info-select-node)
-         (goto-char (or anchorpos (point-min)))))
+                     (throw 'foo t)))))
+
+             ;; Else we may have a node, which we search for:
+             (goto-char (max (point-min)
+                             (- (byte-to-position guesspos) 1000)))
+             
+             ;; Now search from our advised position (or from beg of
+             ;; buffer) to find the actual node.  First, check
+             ;; whether the node is right where we are, in case the
+             ;; buffer begins with a node.
+             (let ((pos (Info-find-node-in-buffer regexp)))
+               (when pos
+                 (goto-char pos)
+                 (throw 'foo t))
+               (error "No such anchor in tag table or node in tag table or file: %s"
+                      nodename)))
+
+           (Info-select-node)
+           (goto-char (or anchorpos (point-min))))))
     ;; If we did not finish finding the specified node,
     ;; go back to the previous one.
     (or Info-current-node no-going-back (null Info-history)
@@ -638,20 +682,23 @@ else defaults to `Top'."
           ;; Verify that none of the files we used has changed
           ;; since we used it.
           (eval (cons 'and
-                      (mapcar '(lambda (elt)
-                                 (let ((curr (file-attributes 
-                                              ;; Handle symlinks
-                                              (file-truename (car elt)))))
-                                   
-                                   ;; Don't compare the access time.
-                                   (if curr (setcar (nthcdr 4 curr) 0))
-                                   (setcar (nthcdr 4 (cdr elt)) 0)
-                                   (equal (cdr elt) curr)))
+                      (mapcar (lambda (elt)
+                                (let ((curr (file-attributes
+                                             ;; Handle symlinks
+                                             (file-truename (car elt)))))
+
+                                  ;; Don't compare the access time.
+                                  (if curr (setcar (nthcdr 4 curr) 0))
+                                  (setcar (nthcdr 4 (cdr elt)) 0)
+                                  (equal (cdr elt) curr)))
                               Info-dir-file-attributes))))
       (progn
        (insert Info-dir-contents)
        (goto-char (point-min)))
-    (let ((dirs Info-directory-list)
+    (let ((dirs (if Info-additional-directory-list
+                              (append Info-directory-list
+                                      Info-additional-directory-list)
+                            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.
@@ -700,7 +747,7 @@ else defaults to `Top'."
          (or (cdr dirs) (setq Info-dir-contents-directory
                               (file-name-as-directory (car dirs))))
          (setq dirs (cdr dirs))))
-      
+
       (or buffers
          (error "Can't find the Info directory node"))
       ;; Distinguish the dir file that comes with Emacs from all the
@@ -718,6 +765,8 @@ else defaults to `Top'."
       ;; Look at each of the other buffers one by one.
       (while others
        (let ((other (car others))
+             ;; Bind this in case the user sets it to nil.
+             (case-fold-search t)
              this-buffer-nodes)
          ;; In each, find all the menus.
          (save-excursion
@@ -745,7 +794,8 @@ else defaults to `Top'."
              (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:")
+      (let ((case-fold-search t)
+           (re-search-forward "^\\* Menu:")))
       (forward-line 1)
       (let ((menu-items '("top"))
            (nodes nodes)
@@ -766,7 +816,8 @@ else defaults to `Top'."
       ;; Now take each node of each of the other buffers
       ;; and merge it into the main buffer.
       (while nodes
-       (let ((nodename (car (car nodes))))
+       (let ((case-fold-search t)
+             (nodename (car (car nodes))))
          (goto-char (point-min))
          ;; Find the like-named node in the main buffer.
          (if (re-search-forward (concat "^\^_.*\n.*Node: "
@@ -844,54 +895,69 @@ else defaults to `Top'."
     (if (numberp nodepos)
        (+ (- nodepos lastfilepos) (point)))))
 
-;; Select the info node that point is in.
+(defvar Info-header-line nil
+  "If the info node header is hidden, the text of the header.")
+
 (defun Info-select-node ()
-  ;; Bind this in case the user sets it to nil.
+"Select the info node that point is in.
+Bind this in case the user sets it to nil."
   (let ((case-fold-search t))
     (save-excursion
-     ;; Find beginning of node.
-     (if (search-backward "\n\^_" nil 'move)
-        (forward-line 2)
-       (if (looking-at "\^_")
-          (forward-line 1)
-        (signal 'search-failed (list "\n\^_"))))
-     ;; Get nodename spelled as it is in the node.
-     (re-search-forward "Node:[ \t]*")
-     (setq Info-current-node
-          (buffer-substring-no-properties (point)
-                                          (progn
-                                           (skip-chars-forward "^,\t\n")
-                                           (point))))
-     (Info-set-mode-line)
-     ;; Find the end of it, and narrow.
-     (beginning-of-line)
-     (let (active-expression)
-       (narrow-to-region (point)
-                        (if (re-search-forward "\n[\^_\f]" nil t)
-                            (prog1
-                             (1- (point))
-                             (if (looking-at "[\n\^_\f]*execute: ")
-                                 (progn
-                                   (goto-char (match-end 0))
-                                   (setq active-expression
-                                         (read (current-buffer))))))
-                          (point-max)))
-       (if Info-enable-active-nodes (eval active-expression))
-       (if Info-fontify (Info-fontify-node))
-       (run-hooks 'Info-selection-hook)))))
+      ;; Find beginning of node.
+      (if (search-backward "\n\^_" nil 'move)
+         (forward-line 2)
+       (if (looking-at "\^_")
+           (forward-line 1)
+         (signal 'search-failed (list "\n\^_"))))
+      ;; Get nodename spelled as it is in the node.
+      (re-search-forward "Node:[ \t]*")
+      (setq Info-current-node
+           (buffer-substring-no-properties (point)
+                                           (progn
+                                             (skip-chars-forward "^,\t\n")
+                                             (point))))
+      (Info-set-mode-line)
+      ;; Find the end of it, and narrow.
+      (beginning-of-line)
+      (let (active-expression)
+       ;; Narrow to the node contents
+       (narrow-to-region (point)
+                         (if (re-search-forward "\n[\^_\f]" nil t)
+                             (prog1
+                                 (1- (point))
+                               (if (looking-at "[\n\^_\f]*execute: ")
+                                   (progn
+                                     (goto-char (match-end 0))
+                                     (setq active-expression
+                                           (read (current-buffer))))))
+                           (point-max)))
+       (if Info-enable-active-nodes (eval active-expression))
+       (if Info-fontify (Info-fontify-node))
+       (if Info-use-header-line
+           (Info-setup-header-line)
+         (setq Info-header-line nil))
+       (run-hooks 'Info-selection-hook)))))
 
 (defun Info-set-mode-line ()
   (setq mode-line-buffer-identification
        (concat
-        "  Info:  ("
-        (if Info-current-file
-            (file-name-nondirectory (if (stringp Info-current-file)
-                                        Info-current-file
-                                      (or buffer-file-name "")))
-          "")
-        ")"
+        "  *Info* ("
+        (file-name-nondirectory (if (stringp Info-current-file)
+                                    Info-current-file
+                                  (or buffer-file-name "")))
+        ") "
         (or Info-current-node ""))))
 \f
+;; Skip the node header and make it into a header-line.  This function
+;; should be called when the node is already narrowed.
+(defun Info-setup-header-line ()
+  (goto-char (point-min))
+  (forward-line 1)
+  (set (make-local-variable 'Info-header-line)
+       (buffer-substring (point-min) (1- (point))))
+  (setq header-line-format 'Info-header-line)
+  (narrow-to-region (point) (point-max)))
+\f
 ;; Go to an info node specified with a filename-and-nodename string
 ;; of the sort that is found in pointers in nodes.
 
@@ -902,8 +968,8 @@ If FORK is a string, it is the name to use for the new buffer."
   (interactive (list (Info-read-node-name "Goto node: ") current-prefix-arg))
   (info-initialize)
   (if fork
-    (set-buffer
-     (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t)))
+      (set-buffer
+       (clone-buffer (concat "*info-" (if (stringp fork) fork nodename) "*") t)))
   (let (filename)
     (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
                  nodename)
@@ -961,26 +1027,23 @@ If FORK is a string, it is the name to use for the new buffer."
                  (set-buffer (marker-buffer marker))
                  (widen)
                  (goto-char marker)
-                 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
+                 (while (re-search-forward "\n\\(Node\\|Ref\\): \\(.*\\)\177" nil t)
                    (setq compl
-                         (cons (list (buffer-substring (match-beginning 1)
-                                                       (match-end 1)))
+                         (cons (list (match-string-no-properties 2))
                                compl))))
              (widen)
              (goto-char (point-min))
              ;; If the buffer begins with a node header, process that first.
              (if (Info-node-at-bob-matching node-regexp)
-                 (setq compl (list (buffer-substring (match-beginning 1)
-                                                     (match-end 1)))))
+                 (setq compl (list (match-string-no-properties 1))))
              ;; Now for the rest of the nodes.
              (while (search-forward "\n\^_" nil t)
                (forward-line 1)
                (let ((beg (point)))
                  (forward-line 1)
                  (if (re-search-backward node-regexp beg t)
-                     (setq compl 
-                           (cons (list (buffer-substring (match-beginning 1)
-                                                         (match-end 1)))
+                     (setq compl
+                           (cons (list (match-string-no-properties 1))
                                  compl))))))))
        (setq compl (cons '("*") compl))
        (setq Info-current-file-completions compl))))
@@ -996,16 +1059,17 @@ If FORK is a string, it is the name to use for the new buffer."
          (setq hl nil))                ;terminate the while at next iter
       (setq hl (cdr hl)))))
 \f
-(defvar Info-last-search nil
-  "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.")
+(defvar Info-search-history nil
+  "The history list for `Info-search'.")
 
 (defun Info-search (regexp)
   "Search for REGEXP, starting from point, and select node it's found in."
-  (interactive "sSearch (regexp): ")
-  (if transient-mark-mode (deactivate-mark))
-  (if (equal regexp "")
-      (setq regexp Info-last-search)
-    (setq Info-last-search regexp))
+  (interactive (list (read-string "Regexp search: "
+                                 nil 'Info-search-history)))
+  (when transient-mark-mode
+    (deactivate-mark))
+  (when (equal regexp "")
+    (setq regexp (car Info-search-history)))
   (when regexp
     (let ((found ()) current
          (onode Info-current-node)
@@ -1021,7 +1085,7 @@ If FORK is a string, it is the name to use for the new buffer."
            (condition-case err
                (progn (re-search-forward regexp) (setq found (point)))
              (search-failed nil)))))
-      (if (not found) ;can only happen in subfile case -- else would have erred
+      (if (not found)                  ;can only happen in subfile case -- else would have erred
          (unwind-protect
              (let ((list ()))
                (save-excursion
@@ -1039,8 +1103,7 @@ If FORK is a string, it is the name to use for the new buffer."
                      (re-search-forward "\\(^.*\\): [0-9]+$")
                      (goto-char (+ (match-end 1) 2))
                      (setq list (cons (cons (read (current-buffer))
-                                            (buffer-substring
-                                             (match-beginning 1) (match-end 1)))
+                                            (match-string-no-properties 1))
                                       list))
                      (goto-char (1+ (match-end 0))))
                    (setq list (nreverse list)
@@ -1061,36 +1124,41 @@ If FORK is a string, it is the name to use for the new buffer."
                       (goto-char opoint)
                       (Info-select-node)
                       (set-window-start (selected-window) ostart)))))
-    (widen)
-    (goto-char found)
-    (Info-select-node)
-    ;; Use string-equal, not equal, to ignore text props.
-    (or (and (string-equal onode Info-current-node)
-            (equal ofile Info-current-file))
-       (setq Info-history (cons (list ofile onode opoint)
-                                Info-history))))))
+      (widen)
+      (goto-char found)
+      (Info-select-node)
+      ;; Use string-equal, not equal, to ignore text props.
+      (or (and (string-equal onode Info-current-node)
+              (equal ofile Info-current-file))
+         (setq Info-history (cons (list ofile onode opoint)
+                                  Info-history))))))
 \f
-;; Extract the value of the node-pointer named NAME.
-;; If there is none, use ERRORNAME in the error message; 
-;; if ERRORNAME is nil, just return nil.
 (defun Info-extract-pointer (name &optional errorname)
-  ;; Bind this in case the user sets it to nil.
+  "Extract the value of the node-pointer named NAME.
+If there is none, use ERRORNAME in the error message;
+if ERRORNAME is nil, just return nil.
+Bind this in case the user sets it to nil."
   (let ((case-fold-search t))
     (save-excursion
-      (goto-char (point-min))
-      (forward-line 1)
-      (if (re-search-backward (concat name ":") nil t)
-         (progn
+      (save-restriction
+       (goto-char (point-min))
+       (when Info-header-line
+         ;; expose the header line in the buffer
+         (widen)
+         (forward-line -1))
+       (let ((bound (point)))
+         (forward-line 1)
+         (cond ((re-search-backward (concat name ":") nil bound)
            (goto-char (match-end 0))
            (Info-following-node-name))
-       (if (eq errorname t)
-           nil
-         (error "Node has no %s" (capitalize (or errorname name))))))))
+               ((not (eq errorname t))
+                (error "Node has no %s"
+                       (capitalize (or errorname name))))))))))
 
-;; Return the node name in the buffer following point.
-;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
-;; saying which chars may appear in the node name.
 (defun Info-following-node-name (&optional allowedchars)
+  "Return the node name in the buffer following point.
+ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
+saying which chars may appear in the node name."
   (skip-chars-forward " \t")
   (buffer-substring-no-properties
    (point)
@@ -1137,14 +1205,15 @@ If SAME-FILE is non-nil, do not move to a different Info file."
     (setq Info-history (cdr Info-history))
     (goto-char opoint)))
 
+;;;###autoload
 (defun Info-directory ()
   "Go to the Info directory node."
   (interactive)
   (Info-find-node "dir" "top"))
 \f
 (defun Info-follow-reference (footnotename)
-  "Follow cross reference named NAME to the node it refers to.
-NAME may be an abbreviation of the reference name."
+  "Follow cross reference named FOOTNOTENAME to the node it refers to.
+FOOTNOTENAME may be an abbreviation of the reference name."
   (interactive
    (let ((completion-ignore-case t)
         (case-fold-search t)
@@ -1158,7 +1227,7 @@ NAME may be an abbreviation of the reference name."
 
        (goto-char (point-min))
        (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t)
-        (setq str (buffer-substring
+        (setq str (buffer-substring-no-properties
                    (match-beginning 1)
                    (1- (point))))
         ;; See if this one should be the default.
@@ -1255,7 +1324,8 @@ NAME may be an abbreviation of the reference name."
 (defvar Info-complete-menu-buffer)
 
 (defun Info-complete-menu-item (string predicate action)
-  (let ((case-fold-search t))
+  (let ((completion-ignore-case t)
+       (case-fold-search t))
     (cond ((eq action nil)
           (let (completions
                 (pattern (concat "\n\\* +\\("
@@ -1266,12 +1336,10 @@ NAME may be an abbreviation of the reference name."
               (goto-char (point-min))
               (search-forward "\n* Menu:")
               (while (re-search-forward pattern nil t)
-                (setq completions (cons (cons (format "%s"
-                                                      (buffer-substring
-                                                       (match-beginning 1)
-                                                       (match-end 1)))
-                                              (match-beginning 1))
-                                        completions))))
+                (setq completions
+                      (cons (cons (match-string-no-properties 1)
+                                  (match-beginning 1))
+                            completions))))
             (try-completion string completions predicate)))
          ((eq action t)
           (let (completions
@@ -1283,11 +1351,9 @@ NAME may be an abbreviation of the reference name."
               (goto-char (point-min))
               (search-forward "\n* Menu:")
               (while (re-search-forward pattern nil t)
-                (setq completions (cons (cons (format "%s"
-                                                      (buffer-substring
-                                                       (match-beginning 1)
-                                                       (match-end 1)))
-                                              (match-beginning 1))
+                (setq completions (cons (cons
+                                         (match-string-no-properties 1)
+                                         (match-beginning 1))
                                         completions))))
             (all-completions string completions predicate)))
          (t
@@ -1310,7 +1376,8 @@ Completion is allowed, and the menu item point is on is the default."
         (default nil)
         (p (point))
         beg
-        (last nil))
+        (last nil)
+        (case-fold-search t))
      (save-excursion
        (goto-char (point-min))
        (if (not (search-forward "\n* menu:" nil t))
@@ -1321,9 +1388,7 @@ Completion is allowed, and the menu item point is on is the default."
              (goto-char p)
              (end-of-line)
              (if (re-search-backward "\n\\* +\\([^:\t\n]*\\):" beg t)
-                 (setq default (format "%s" (buffer-substring
-                                             (match-beginning 1)
-                                             (match-end 1))))))))
+                 (setq default (match-string-no-properties 1))))))
      (let ((item nil))
        (while (null item)
         (setq item (let ((completion-ignore-case t)
@@ -1331,7 +1396,7 @@ Completion is allowed, and the menu item point is on is the default."
                      (completing-read (if default
                                           (format "Menu item (default %s): "
                                                   default)
-                                          "Menu item: ")
+                                        "Menu item: ")
                                       'Info-complete-menu-item nil t)))
         ;; we rely on the fact that completing-read accepts an input
         ;; of "" even when the require-match argument is true and ""
@@ -1339,40 +1404,42 @@ Completion is allowed, and the menu item point is on is the default."
         (if (string= item "")
             (if default
                 (setq item default)
-                ;; ask again
-                (setq item nil))))
+              ;; ask again
+              (setq item nil))))
        (list item current-prefix-arg))))
   ;; there is a problem here in that if several menu items have the same
   ;; name you can only go to the node of the first with this command.
   (Info-goto-node (Info-extract-menu-item menu-item) (if fork menu-item)))
-  
+
 (defun Info-extract-menu-item (menu-item)
   (setq menu-item (regexp-quote menu-item))
   (let ((case-fold-search t))
     (save-excursion
-      (goto-char (point-min))
-      (or (search-forward "\n* menu:" nil t)
-         (error "No menu in this node"))
-      (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t)
-         (re-search-forward (concat "\n\\* +" menu-item) nil t)
-         (error "No such item in menu"))
-      (beginning-of-line)
-      (forward-char 2)
-      (Info-extract-menu-node-name))))
+      (let ((case-fold-search t))
+       (goto-char (point-min))
+       (or (search-forward "\n* menu:" nil t)
+           (error "No menu in this node"))
+       (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t)
+           (re-search-forward (concat "\n\\* +" menu-item) nil t)
+           (error "No such item in menu"))
+       (beginning-of-line)
+       (forward-char 2)
+       (Info-extract-menu-node-name)))))
 
 ;; If COUNT is nil, use the last item in the menu.
 (defun Info-extract-menu-counting (count)
   (let ((case-fold-search t))
     (save-excursion
-      (goto-char (point-min))
-      (or (search-forward "\n* menu:" nil t)
-         (error "No menu in this node"))
-      (if count
-         (or (search-forward "\n* " nil t count)
-             (error "Too few items in menu"))
-       (while (search-forward "\n* " nil t)
-         nil))
-      (Info-extract-menu-node-name))))
+      (let ((case-fold-search t))
+       (goto-char (point-min))
+       (or (search-forward "\n* menu:" nil t)
+           (error "No menu in this node"))
+       (if count
+           (or (search-forward "\n* " nil t count)
+               (error "Too few items in menu"))
+         (while (search-forward "\n* " nil t)
+           nil))
+       (Info-extract-menu-node-name)))))
 
 (defun Info-nth-menu-item ()
   "Go to the node of the Nth menu item.
@@ -1391,11 +1458,12 @@ N is the digit argument used to invoke this command."
   "Go to the final node in this file."
   (interactive)
   (Info-goto-node "Top")
-  (let (Info-history)
+  (let ((Info-history nil)
+       (case-fold-search t))
     ;; Go to the last node in the menu of Top.
     (Info-goto-node (Info-extract-menu-counting nil))
     ;; If the last node in the menu is not last in pointer structure,
-    ;; move forward until we can't go any farther. 
+    ;; move forward until we can't go any farther.
     (while (Info-forward-node t t) nil)
     ;; Then keep moving down to last subnode, unless we reach an index.
     (while (and (not (string-match "\\<index\\>" Info-current-node))
@@ -1407,36 +1475,38 @@ N is the digit argument used to invoke this command."
   (interactive)
   (goto-char (point-min))
   (forward-line 1)
-  ;; three possibilities, in order of priority:
-  ;;     1. next node is in a menu in this node (but not in an index)
-  ;;     2. next node is next at same level
-  ;;     3. next node is up and next
-  (cond ((and (not not-down)
-              (save-excursion (search-forward "\n* menu:" nil t))
-             (not (string-match "\\<index\\>" Info-current-node)))
-        (Info-goto-node (Info-extract-menu-counting 1))
-         t)
-        ((save-excursion (search-backward "next:" nil t))
-         (Info-next)
-         t)
-        ((and (save-excursion (search-backward "up:" nil t))
-             ;; Use string-equal, not equal, to ignore text props.
-             (not (string-equal (downcase (Info-extract-pointer "up"))
-                                "top")))
-         (let ((old-node Info-current-node))
-           (Info-up)
-           (let (Info-history success)
-             (unwind-protect
-                 (setq success (Info-forward-node t no-error))
-               (or success (Info-goto-node old-node))))))
-        (no-error nil)
-        (t (error "No pointer forward from this node"))))
+  (let ((case-fold-search t))
+    ;; three possibilities, in order of priority:
+    ;;     1. next node is in a menu in this node (but not in an index)
+    ;;     2. next node is next at same level
+    ;;     3. next node is up and next
+    (cond ((and (not not-down)
+               (save-excursion (search-forward "\n* menu:" nil t))
+               (not (string-match "\\<index\\>" Info-current-node)))
+          (Info-goto-node (Info-extract-menu-counting 1))
+          t)
+         ((save-excursion (search-backward "next:" nil t))
+          (Info-next)
+          t)
+         ((and (save-excursion (search-backward "up:" nil t))
+               ;; Use string-equal, not equal, to ignore text props.
+               (not (string-equal (downcase (Info-extract-pointer "up"))
+                                  "top")))
+          (let ((old-node Info-current-node))
+            (Info-up)
+            (let (Info-history success)
+              (unwind-protect
+                  (setq success (Info-forward-node t no-error))
+                (or success (Info-goto-node old-node))))))
+         (no-error nil)
+         (t (error "No pointer forward from this node")))))
 
 (defun Info-backward-node ()
   "Go backward one node, considering all nodes as forming one sequence."
   (interactive)
   (let ((prevnode (Info-extract-pointer "prev[ious]*" t))
-       (upnode (Info-extract-pointer "up" t)))
+       (upnode (Info-extract-pointer "up" t))
+       (case-fold-search t))
     (cond ((and upnode (string-match "(" upnode))
           (error "First node in file"))
          ((and upnode (or (null prevnode)
@@ -1465,12 +1535,14 @@ N is the digit argument used to invoke this command."
 
 (defun Info-next-menu-item ()
   (interactive)
-  (let ((node
-        (save-excursion
-          (forward-line -1)
-          (search-forward "\n* menu:" nil t)
-          (and (search-forward "\n* " nil t)
-               (Info-extract-menu-node-name)))))
+  ;; Bind this in case the user sets it to nil.
+  (let* ((case-fold-search t)
+        (node
+         (save-excursion
+           (forward-line -1)
+           (search-forward "\n* menu:" nil t)
+           (and (search-forward "\n* " nil t)
+                (Info-extract-menu-node-name)))))
     (if node (Info-goto-node node)
       (error "No more items in menu"))))
 
@@ -1478,9 +1550,11 @@ N is the digit argument used to invoke this command."
   (interactive)
   (save-excursion
     (forward-line 1)
-    (let ((beg (save-excursion
-                (and (search-backward "\n* menu:" nil t)
-                     (point)))))
+    ;; Bind this in case the user sets it to nil.
+    (let* ((case-fold-search t)
+          (beg (save-excursion
+                 (and (search-backward "\n* menu:" nil t)
+                      (point)))))
       (or (and beg (search-backward "\n* " beg t))
          (error "No previous items in menu")))
     (Info-goto-node (save-excursion
@@ -1532,8 +1606,9 @@ N is the digit argument used to invoke this command."
         (recenter -1))
        ((Info-no-error (Info-up t))
         (goto-char (point-min))
-        (or (search-forward "\n* Menu:" nil t)
-            (goto-char (point-max))))
+        (let ((case-fold-search t))
+          (or (search-forward "\n* Menu:" nil t)
+              (goto-char (point-max)))))
        (t (error "No previous nodes"))))
 
 (defun Info-scroll-up ()
@@ -1551,11 +1626,12 @@ normally result from this command, but can happen in other ways.)"
   (if (or (< (window-start) (point-min))
          (> (window-start) (point-max)))
       (set-window-start (selected-window) (point)))
-  (let ((virtual-end (save-excursion
-                      (goto-char (point-min))
-                      (if (search-forward "\n* Menu:" nil t)
-                          (point)
-                        (point-max)))))
+  (let* ((case-fold-search t)
+        (virtual-end (save-excursion
+                       (goto-char (point-min))
+                       (if (search-forward "\n* Menu:" nil t)
+                           (point)
+                         (point-max)))))
     (if (or (< virtual-end (window-start))
            (pos-visible-in-window-p virtual-end))
        (Info-next-preorder)
@@ -1570,7 +1646,8 @@ previous node or back up to the parent node."
   (if (or (< (window-start) (point-min))
          (> (window-start) (point-max)))
       (set-window-start (selected-window) (point)))
-  (let* ((current-point (point))
+  (let* ((case-fold-search t)
+        (current-point (point))
         (virtual-end (save-excursion
                        (beginning-of-line)
                        (setq current-point (point))
@@ -1622,7 +1699,7 @@ previous node or back up to the parent node."
          (Info-prev-reference t)))))
 
 (defun Info-index (topic)
-  "Look up a string in the index for this file.
+  "Look up a string TOPIC in the index for this file.
 The index is defined as the first node in the top-level menu whose
 name contains the word \"Index\", plus any immediately following
 nodes whose names also contain the word \"Index\".
@@ -1660,15 +1737,11 @@ Give a blank topic name to go to the Index node itself."
                (goto-char (point-min))
                (while (re-search-forward pattern nil t)
                  (setq matches
-                       (cons (list (buffer-substring (match-beginning 1)
-                                                     (match-end 1))
-                                   (buffer-substring (match-beginning 2)
-                                                     (match-end 2))
+                       (cons (list (match-string-no-properties 1)
+                                   (match-string-no-properties 2)
                                    Info-current-node
                                    (string-to-int (concat "0"
-                                                          (buffer-substring
-                                                           (match-beginning 3)
-                                                           (match-end 3)))))
+                                                          (match-string 3))))
                              matches)))
                (and (setq node (Info-extract-pointer "next" t))
                     (string-match "\\<Index\\>" node)))
@@ -1699,7 +1772,7 @@ Give a blank topic name to go to the Index node itself."
   (Info-goto-node (nth 1 (car Info-index-alternatives)))
   (if (> (nth 3 (car Info-index-alternatives)) 0)
       (forward-line (nth 3 (car Info-index-alternatives)))
-    (forward-line 3)  ; don't search in headers
+    (forward-line 3)                   ; don't search in headers
     (let ((name (car (car Info-index-alternatives))))
       (Info-find-index-name name)))
   (message "Found `%s' in %s.  %s"
@@ -1759,15 +1832,15 @@ Give a blank topic name to go to the Index node itself."
     (bury-buffer "*Help*")))
 \f
 (defun Info-get-token (pos start all &optional errorstring)
-  "Return the token around POS,
+  "Return the token around POS.
 POS must be somewhere inside the token
 START is a regular expression which will match the
     beginning of the tokens delimited string
 ALL is a regular expression with a single
     parenthesized subpattern which is the token to be
-    returned. E.g. '{\(.*\)}' would return any string
+    returned.  E.g. '{\(.*\)}' would return any string
     enclosed in braces around POS.
-SIG optional fourth argument, controls action on no match
+ERRORSTRING optional fourth argument, controls action on no match
     nil: return nil
     t: beep
     a string: signal an error, using that string."
@@ -1790,7 +1863,7 @@ SIG optional fourth argument, controls action on no match
                                          (> (match-end 0) pos))))))
        (if (and found (<= (match-beginning 0) pos)
                 (> (match-end 0) pos))
-           (buffer-substring (match-beginning 1) (match-end 1))
+           (match-string-no-properties 1)
          (cond ((null errorstring)
                 nil)
                ((eq errorstring t)
@@ -1896,30 +1969,50 @@ If no reference to follow, moves to the next node, or up if none."
   )
 
 (defun Info-check-pointer (item)
-  ;; Non-nil if ITEM is present in this node.
+  "Non-nil if ITEM is present in this node."
   (condition-case nil
       (Info-extract-pointer item)
     (error nil)))
 
-(easy-menu-define Info-mode-menu Info-mode-map
-  "Menu for info files."
-  '("Info"
-    ["Up" Info-up (Info-check-pointer "up")]
-    ["Next" Info-next (Info-check-pointer "next")]
-    ["Previous" Info-prev (Info-check-pointer "prev[ious]*")]
-    ("Menu item" ["You should never see this" report-emacs-bug t])
-    ("Reference" ["You should never see this" report-emacs-bug t])
-    ["Search..." Info-search t]
-    ["Goto node..." Info-goto-node t]
-    ["Last" Info-last Info-history]
-    ["Exit" Info-exit t]))
+(easy-menu-define
+ Info-mode-menu Info-mode-map
+ "Menu for info files."
+ '("Info"
+   ["Up" Info-up :active (Info-check-pointer "up")
+    :help "Go up in the Info tree"]
+   ["Next" Info-next :active (Info-check-pointer "next")
+    :help "Go to the next node"]
+   ["Previous" Info-prev :active (Info-check-pointer "prev[ious]*")
+    :help "Go to the previous node"]
+   ["Backward" Info-backward-node
+    :help "Go backward one node, considering all as a sequence"]
+   ["Forward" Info-forward-node
+    :help "Go forward one node, considering all as a sequence"]
+   ["Top" Info-top-node
+    :help "Go to top node of file"]
+   ["Final Node" Info-final-node
+    :help "Go to final node in this file"]
+   ("Menu Item" ["You should never see this" report-emacs-bug t])
+   ("Reference" ["You should never see this" report-emacs-bug t])
+   ["Search..." Info-search
+    :help "Search for regular expression in this Info file"]
+   ["Goto Node..." Info-goto-node
+    :help "Go to a named node"]
+   ["Last" Info-last Info-history
+    :help "Go to the last node you were at"]
+   ("Index..."
+    ["Lookup a String" Info-index
+     :help "Look for a string in the index items"]
+    ["Next Matching Item" Info-index-next
+     :help "Look for another occurrence of previous item"])
+   ["Exit" Info-exit t]))
 
 (defvar Info-menu-last-node nil)
 ;; Last node the menu was created for.
 ;; Value is a list, (FILE-NAME NODE-NAME).
 
 (defun Info-menu-update ()
-  ;; Update the Info menu for the current node.
+  "Update the Info menu for the current node."
   (condition-case nil
       (if (or (not (eq major-mode 'Info-mode))
              (equal (list Info-current-file Info-current-node)
@@ -1931,13 +2024,13 @@ If no reference to follow, moves to the next node, or up if none."
                                    (Info-complete-menu-item
                                     "" (lambda (e) t) t)
                                  (error nil))))
-              entries current 
+              entries current
               (number 0))
          (while (and items (< number 9))
            (setq current (car items)
                  items (cdr items)
                  number (1+ number))
-           (setq entries (cons `[,current 
+           (setq entries (cons `[,current
                                  (Info-menu ,current)
                                  :keys ,(format "%d" number)]
                                entries)))
@@ -1945,10 +2038,10 @@ If no reference to follow, moves to the next node, or up if none."
              (setq entries (cons ["Other..." Info-menu t] entries)))
          (or entries
              (setq entries (list ["No menu" nil nil])))
-         (easy-menu-change '("Info") "Menu item" (nreverse entries)))
+         (easy-menu-change '("Info") "Menu Item" (nreverse entries)))
        ;; Update reference menu.  Code stolen from `Info-follow-reference'.
        (let ((items nil)
-             str i entries current 
+             str i entries current
              (number 0)
              (case-fold-search t))
          (save-excursion
@@ -1968,7 +2061,7 @@ If no reference to follow, moves to the next node, or up if none."
            (setq current (car items)
                  items (cdr items)
                  number (1+ number))
-           (setq entries (cons `[,current 
+           (setq entries (cons `[,current
                                  (Info-follow-reference ,current)
                                  t]
                                entries)))
@@ -1985,15 +2078,15 @@ If no reference to follow, moves to the next node, or up if none."
 
 \f
 ;; Info mode is suitable only for specially formatted data.
-(put 'info-mode 'mode-class 'special)
+(put 'Info-mode 'mode-class 'special)
 
 (defun Info-mode ()
-  "\\<Info-mode-map>
-Info mode provides commands for browsing through the Info documentation tree.
+  "Info mode provides commands for browsing through the Info documentation tree.
 Documentation in Info is divided into \"nodes\", each of which discusses
 one topic and contains references to other nodes which discuss related
 topics.  Info has commands to follow the references and show you other nodes.
 
+\\<Info-mode-map>\
 \\[Info-help]  Invoke the Info tutorial.
 \\[Info-exit]  Quit Info: reselect previously selected buffer.
 
@@ -2026,7 +2119,7 @@ When after all menu items (or if their is no menu), move up to
 the parent node.
 \\[Info-scroll-down]   Normally, scroll backward.  If the beginning of the buffer is
 already visible, try to go to the previous menu entry, or up if there is none.
-\\[beginning-of-buffer]        Go to beginning of node.  
+\\[beginning-of-buffer]        Go to beginning of node.
 
 Advanced commands:
 \\[Info-exit]  Quit Info: reselect previously selected buffer.
@@ -2085,7 +2178,7 @@ Advanced commands:
   (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))
 
 ;; Info-edit mode is suitable only for specially formatted data.
-(put 'info-edit-mode 'mode-class 'special)
+(put 'Info-edit-mode 'mode-class 'special)
 
 (defun Info-edit-mode ()
   "Major mode for editing the contents of an Info node.
@@ -2109,7 +2202,7 @@ Allowed only if variable `Info-enable-edit' is non-nil."
       (error "Editing info nodes is not enabled"))
   (Info-edit-mode)
   (message "%s" (substitute-command-keys
-           "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info")))
+                "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info")))
 
 (defun Info-cease-edit ()
   "Finish editing Info node; switch back to Info proper."
@@ -2129,8 +2222,14 @@ Allowed only if variable `Info-enable-edit' is non-nil."
        (message "Tags may have changed.  Use Info-tagify if necessary")))
 \f
 (defvar Info-file-list-for-emacs
-  '("ediff" "forms" "gnus" "info" ("mh" . "mh-e") "sc" "message"
-    ("dired" . "dired-x") ("c" . "ccmode") "viper")
+  '("ediff" "forms" "gnus" ("mh" . "mh-e") "sc" "message"
+    ("dired" . "dired-x") ("c" . "ccmode") "viper" "vip"
+    ("skeleton" . "autotype") ("auto-insert" . "autotype")
+    ("copyright" . "autotype") ("executable" . "autotype")
+    ("time-stamp" . "autotype") ("quickurl" . "autotype")
+    ("tempo" . "autotype") ("hippie-expand" . "autotype")
+    ("cvs" . "pcl-cvs")
+    "ebrowse" "cl" "idlwave" "reftex" "widget" "woman")
   "List of Info files that describe Emacs commands.
 An element can be a file name, or a list of the form (PREFIX . FILE)
 where PREFIX is a name prefix and FILE is the file to look in.
@@ -2141,11 +2240,11 @@ If the element is just a file name, the file name also serves as the prefix.")
 The `info-file' property of COMMAND says which Info manual to search.
 If COMMAND has no property, the variable `Info-file-list-for-emacs'
 defines heuristics for which Info manual to try.
-The locations are of the format used in Info-history, i.e.
+The locations are of the format used in `Info-history', i.e.
 \(FILENAME NODENAME BUFFERPOS\)."
   (let ((where '())
        (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command))
-                         ":\\s *\\(.*\\)\\.$"))
+                         "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\.$"))
        (info-file "emacs"))            ;default
     ;; Determine which info file this command is documented in.
     (if (get command 'info-file)
@@ -2164,24 +2263,30 @@ The locations are of the format used in Info-history, i.e.
            (if (string-match regexp (symbol-name command))
                (setq info-file file file-list nil))
            (setq file-list (cdr file-list))))))
-    (save-excursion
-      (condition-case nil
-         (Info-find-node info-file "Command Index")
-       ;; Some manuals may not have a separate Command Index node,
-       ;; so try just Index instead.
-       (error
-        (Info-find-node info-file "Index")))
-      ;; Take the index node off the Info history.
-      (setq Info-history (cdr Info-history))
-      (goto-char (point-max))
-      (while (re-search-backward cmd-desc nil t)
-         (setq where (cons (list Info-current-file
-                                 (buffer-substring
-                                  (match-beginning 1)
-                                  (match-end 1))
-                                 0)
-                           where)))
-      where)))
+    (Info-find-node info-file "Top")
+    (or (and (search-forward "\n* menu:" nil t)
+            (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
+       (error "Info file `%s' appears to lack an index" info-file))
+    (goto-char (match-beginning 1))
+    ;; Bind Info-history to nil, to prevent the index nodes from
+    ;; getting into the node history.
+    (let ((Info-history nil)
+         (exact nil)
+         node found)
+      (Info-goto-node (Info-extract-menu-node-name))
+      (while
+         (progn
+           (goto-char (point-min))
+           (while (re-search-forward cmd-desc nil t)
+             (setq where
+                   (cons (list Info-current-file
+                               (match-string-no-properties 2)
+                               0)
+                         where)))
+           (and (setq node (Info-extract-pointer "next" t))
+                (string-match "\\<Index\\>" node)))
+       (Info-goto-node node)))
+    where))
 
 ;;;###autoload
 (defun Info-goto-emacs-command-node (command)
@@ -2201,13 +2306,17 @@ the variable `Info-file-list-for-emacs'."
          ;; FIXME It would be cool if this could use a buffer other
          ;; than *info*.
          (pop-to-buffer "*info*")
-         (Info-find-node (car (car where))
-                         (car (cdr (car where))))
+         ;; Bind Info-history to nil, to prevent the last Index node
+         ;; visited by Info-find-emacs-command-nodes from being
+         ;; pushed onto the history.
+         (let ((Info-history nil))
+           (Info-find-node (car (car where))
+                           (car (cdr (car where)))))
          (if (> num-matches 1)
              (progn
-               ;; Info-find-node already pushed (car where) onto
-               ;; Info-history.  Put the other nodes that were found on
-               ;; the history.
+               ;; (car where) will be pushed onto Info-history
+               ;; when/if they go to another node.  Put the other
+               ;; nodes that were found on the history.
                (setq Info-history (nconc (cdr where) Info-history))
                (message "Found %d other entr%s.  Use %s to see %s."
                         (1- num-matches)
@@ -2219,11 +2328,11 @@ the variable `Info-file-list-for-emacs'."
 ;;;###autoload
 (defun Info-goto-emacs-key-command-node (key)
   "Go to the Info node in the Emacs manual the command bound to KEY, a string.
-Interactively, if the binding is execute-extended-command, a command is read.
+Interactively, if the binding is `execute-extended-command', a command is read.
 The command is found by looking up in Emacs manual's Command Index
 or in another manual found via COMMAND's `info-file' property or
 the variable `Info-file-list-for-emacs'."
-  (interactive "kFind documentation for key:")
+  (interactive "kFind documentation for key: ")
   (let ((command (key-binding key)))
     (cond ((null command)
           (message "%s is undefined" (key-description key)))
@@ -2234,13 +2343,19 @@ the variable `Info-file-list-for-emacs'."
          (t
           (Info-goto-emacs-command-node command)))))
 \f
-(defcustom Info-title-face-alist
-  '((?* bold underline)
-    (?= bold-italic underline)
-    (?- italic underline))
-  "*Alist of face or list of faces to use for pseudo-underlined titles.
-The alist key is the character the title is underlined with (?*, ?= or ?-)."
-  :type '(repeat (list character face face))
+(defface Info-title-1-face
+  '((t (:height 1.2 :inherit Info-title-2-face)))
+  "Face for Info titles at level 1."
+  :group 'info)
+
+(defface Info-title-2-face
+  '((t (:height 1.2 :inherit Info-title-3-face)))
+  "Face for Info titles at level 2."
+  :group 'info)
+
+(defface Info-title-3-face
+  '((t (:height 1.2 :weight bold :inherit variable-pitch)))
+  "Face for Info titles at level 3."
   :group 'info)
 
 (defun Info-fontify-node ()
@@ -2250,30 +2365,45 @@ The alist key is the character the title is underlined with (?*, ?= or ?-)."
       (goto-char (point-min))
       (when (looking-at "^File: [^,: \t]+,?[ \t]+")
        (goto-char (match-end 0))
-       (while
-           (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
+       (while (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
          (goto-char (match-end 0))
-         (if (save-excursion
-               (goto-char (match-beginning 1))
-               (save-match-data (looking-at "Node:")))
-             (put-text-property (match-beginning 2) (match-end 2)
-                                'face 'info-node)
-           (put-text-property (match-beginning 2) (match-end 2)
-                              'face 'info-xref)
-           (put-text-property (match-beginning 2) (match-end 2)
-                              'mouse-face 'highlight))))
+         (let* ((nbeg (match-beginning 2))
+                (nend (match-end 2))
+                (tbeg (match-beginning 1))
+                (tag (buffer-substring tbeg (match-end 1))))
+           (if (string-equal tag "Node")
+               (put-text-property nbeg nend 'face 'info-header-node)
+             (put-text-property nbeg nend 'face 'info-header-xref)
+             (put-text-property nbeg nend 'mouse-face 'highlight)
+             (put-text-property tbeg nend
+                                'help-echo
+                                (concat "Goto node "
+                                        (buffer-substring nbeg nend)))
+             (let ((fun (cdr (assoc tag '(("Prev" . Info-prev)
+                                          ("Next" . Info-next)
+                                          ("Up" . Info-up))))))
+               (when fun
+                 (let ((keymap (make-sparse-keymap)))
+                   (define-key keymap [header-line mouse-1] fun)
+                   (define-key keymap [header-line mouse-2] fun)
+                   (put-text-property tbeg nend 'local-map keymap))))
+             ))))
       (goto-char (point-min))
       (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$"
-                                nil t)
-       (put-text-property (match-beginning 1) (match-end 1)
-                          'face
-                          (cdr (assq (preceding-char) Info-title-face-alist)))
+                               nil t)
+       (let ((c (preceding-char))
+             face)
+         (cond ((= c ?*) (setq face 'Info-title-1-face))
+               ((= c ?=) (setq face 'Info-title-2-face))
+               (t        (setq face 'Info-title-3-face)))
+         (put-text-property (match-beginning 1) (match-end 1)
+                            'face face))
        ;; This is a serious problem for trying to handle multiple
        ;; frame types at once.  We want this text to be invisible
        ;; on frames that can display the font above.
        (if (memq (framep (selected-frame)) '(x pc w32))
-           (put-text-property (match-end 1) (match-end 2)
-                              'invisible t)))
+           (add-text-properties (match-end 1) (match-end 2)
+                                '(invisible t intangible t))))
       (goto-char (point-min))
       (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t)
        (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
@@ -2290,7 +2420,7 @@ The alist key is the character the title is underlined with (?*, ?= or ?-)."
          (let ((n 0))
            (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t)
              (setq n (1+ n))
-             (if (memq n '(5 9))   ; visual aids to help with 1-9 keys
+             (if (memq n '(5 9))       ; visual aids to help with 1-9 keys
                  (put-text-property (match-beginning 0)
                                     (1+ (match-beginning 0))
                                     'face 'info-menu-5))
@@ -2399,32 +2529,32 @@ specific node to expand."
             (setq completions (cdr completions)))
           t)
        nil))))
-  
+
 (defun Info-speedbar-goto-node (text node indent)
   "When user clicks on TEXT, goto an info NODE.
 The INDENT level is ignored."
-    (select-frame speedbar-attached-frame)
-    (let* ((buff (or (get-buffer "*info*")
-                    (progn (info) (get-buffer "*info*"))))
-          (bwin (get-buffer-window buff 0)))
-      (if bwin
-         (progn
-           (select-window bwin)
-           (raise-frame (window-frame bwin)))
-       (if speedbar-power-click
-           (let ((pop-up-frames t)) (select-window (display-buffer buff)))
-         (select-frame speedbar-attached-frame)
-         (switch-to-buffer buff)))
-      (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node))
-           (file (match-string 1 node))
-           (node (match-string 2 node)))
-       (Info-find-node file node)
-       ;; If we do a find-node, and we were in info mode, restore
-       ;; the old default method.  Once we are in info mode, it makes
-       ;; sense to return to whatever method the user was using before.
-       (if (string= speedbar-initial-expansion-list-name "Info")
-           (speedbar-change-initial-expansion-list
-            speedbar-previously-used-expansion-list-name)))))
+  (select-frame speedbar-attached-frame)
+  (let* ((buff (or (get-buffer "*info*")
+                  (progn (info) (get-buffer "*info*"))))
+        (bwin (get-buffer-window buff 0)))
+    (if bwin
+       (progn
+         (select-window bwin)
+         (raise-frame (window-frame bwin)))
+      (if speedbar-power-click
+         (let ((pop-up-frames t)) (select-window (display-buffer buff)))
+       (select-frame speedbar-attached-frame)
+       (switch-to-buffer buff)))
+    (let ((junk (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node))
+         (file (match-string 1 node))
+         (node (match-string 2 node)))
+      (Info-find-node file node)
+      ;; If we do a find-node, and we were in info mode, restore
+      ;; the old default method.  Once we are in info mode, it makes
+      ;; sense to return to whatever method the user was using before.
+      (if (string= speedbar-initial-expansion-list-name "Info")
+         (speedbar-change-initial-expansion-list
+          speedbar-previously-used-expansion-list-name)))))
 
 (defun Info-speedbar-expand-node (text token indent)
   "Expand the node the user clicked on.
@@ -2434,9 +2564,9 @@ INDENT is the current indentation depth."
   (cond ((string-match "+" text)       ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (if (speedbar-with-writable
-              (save-excursion
-                (end-of-line) (forward-char 1)
-                (Info-speedbar-hierarchy-buttons nil (1+ indent) token)))
+             (save-excursion
+               (end-of-line) (forward-char 1)
+               (Info-speedbar-hierarchy-buttons nil (1+ indent) token)))
             (speedbar-change-expand-button-char ?-)
           (speedbar-change-expand-button-char ??)))
        ((string-match "-" text)        ;we have to contract this node
@@ -2491,6 +2621,14 @@ BUFFER is the buffer speedbar is requesting buttons for."
   (Info-speedbar-hierarchy-buttons nil 0)
   )
 
+(dolist (mess '("^Node has no Previous$"
+               "^No menu in this node$"
+               "^Node has no Next$"
+                "^No cross-references in this node^"
+                search-failed
+               "^No \".*\" in index$"))
+  (add-to-list 'debug-ignored-errors mess))
+
 (provide 'info)
 
 ;;; info.el ends here