(Man-notify-when-ready): Don't use window-system. If
[bpt/emacs.git] / lisp / info.el
index 4a7eea2..78c2193 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
@@ -29,6 +29,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'jka-compr))
+
 (defgroup info nil
   "Info subsystem"
   :group 'help
@@ -59,21 +61,24 @@ The Lisp code is executed when the node is selected.")
   :group 'info)
 
 (defface info-node
-  '((t (:bold t :italic t)))
+  '((((class color)) (:foreground "brown" :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)) (:foreground "magenta4" :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)
@@ -100,11 +105,12 @@ These directories are not searched for merging the `dir' file."
 (defvar Info-current-file nil
   "Info file that Info is now looking at, or nil.
 This is the name that was specified in Info, not the actual file name.
-It doesn't contain directory names or file name extensions added by Info.")
+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.")
@@ -120,7 +126,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.")
@@ -131,6 +137,7 @@ Marker points nowhere if file has no tag table.")
   (if (eq system-type 'ms-dos)
       '( (".gz"      . "gunzip")
         (".z"       . "gunzip")
+        (".bz2"     . "bzip2 -dc")
         (".inz"     . "gunzip")
         (".igz"     . "gunzip")
         (".info.Z"  . "gunzip")
@@ -148,21 +155,25 @@ Marker points nowhere if file has no tag table.")
        (".info.Y".    "unyabba")
        (".info.gz".   "gunzip")
        (".info.z".    "gunzip")
+       (".info.bz2" . "bzip2 -dc")
        (".info".      nil)
        ("-info.Z".   "uncompress")
        ("-info.Y".   "unyabba")
        ("-info.gz".  "gunzip")
+       ("-info.bz2" . "bzip2 -dc")
        ("-info.z".   "gunzip")
        ("-info".     nil)
        ("/index.Z".   "uncompress")
        ("/index.Y".   "unyabba")
        ("/index.gz".  "gunzip")
        ("/index.z".   "gunzip")
+       ("/index.bz2". "bzip2 -dc")
        ("/index".     nil)
        (".Z".         "uncompress")
        (".Y".         "unyabba")
        (".gz".        "gunzip")
        (".z".         "gunzip")
+       (".bz2" .      "bzip2 -dc")
        ("".           nil)))
   "List of file name suffixes and associated decoding commands.
 Each entry should be (SUFFIX . STRING); the file is given to
@@ -239,8 +250,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,7 +267,6 @@ Do the right thing if the file has been compressed or zipped."
                ;; Uninstalled, builddir == srcdir
                (setq alternative source))
              (if (or (member alternative Info-default-directory-list)
-                     (not (file-exists-p alternative))
                      ;; 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))
@@ -265,7 +275,8 @@ Do the right thing if the file has been compressed or zipped."
                        ;; only if we used it for exec-directory also.
                        (not (string= exec-directory
                                      (expand-file-name "lib-src/"
-                                                       installation-directory)))))
+                                                       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'
@@ -280,7 +291,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
@@ -295,7 +306,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))))
@@ -343,22 +354,22 @@ 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.
-  (if filename
+  (if (stringp filename)
       (let (temp temp-downcase found)
         (setq filename (substitute-in-file-name filename))
         (if (string= (downcase filename) "dir")
@@ -403,13 +414,99 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
                   Info-history)))
   ;; Go into info buffer.
   (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
+  (Info-find-node-2 filename nodename no-going-back))
+
+(defun Info-on-current-buffer (&optional nodename)
+  "Use the `Info-mode' to browse the current info buffer.
+If a prefix arg is provided, it queries for the NODENAME which
+else defaults to `Top'."
+  (interactive
+   (list (if current-prefix-arg
+            (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)
       (Info-mode))
   (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
@@ -477,107 +574,52 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
 
           ;; Search file for a suitable node.
          (let ((guesspos (point-min))
-               (regexp
-                (concat "\\(Node:\\|Ref:\\) *\\("
-                        (regexp-quote nodename)
-                        "\\) *[,\t\n\177]"))
+               (regexp (concat "\\(Node:\\|Ref:\\) *\\("
+                               (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:
-                   (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.
-                   (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)
@@ -609,15 +651,15 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
           ;; 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)
@@ -671,7 +713,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
          (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
@@ -689,6 +731,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))
+             ;; 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
@@ -716,7 +760,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
              (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)
@@ -737,7 +782,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
       ;; 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: "
@@ -815,59 +861,64 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
     (if (numberp nodepos)
        (+ (- nodepos lastfilepos) (point)))))
 
-;; Select the info node that point is in.
 (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-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)))))
 
 (defun Info-set-mode-line ()
   (setq mode-line-buffer-identification
        (concat
-        "  Info:  ("
-        (if Info-current-file
-            (file-name-nondirectory Info-current-file)
-          "")
-        ")"
+        "  *Info* ("
+        (file-name-nondirectory (if (stringp Info-current-file)
+                                    Info-current-file
+                                  (or buffer-file-name "")))
+        ") "
         (or Info-current-node ""))))
 \f
 ;; Go to an info node specified with a filename-and-nodename string
 ;; of the sort that is found in pointers in nodes.
 
-(defun Info-goto-node (nodename)
-  "Go to info node named NAME.  Give just NODENAME or (FILENAME)NODENAME."
-  (interactive (list (Info-read-node-name "Goto node: ")))
+(defun Info-goto-node (nodename &optional fork)
+  "Go to info node named NAME.  Give just NODENAME or (FILENAME)NODENAME.
+If FORK is non-nil, show the node in a new info buffer.
+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)))
   (let (filename)
     (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
                  nodename)
@@ -925,27 +976,25 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
                  (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))))
 \f
 (defun Info-restore-point (hl)
@@ -984,7 +1033,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
            (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
@@ -1002,8 +1051,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
                      (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)
@@ -1024,20 +1072,20 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
                       (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))
@@ -1050,10 +1098,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
            nil
          (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)
@@ -1080,7 +1128,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
 If SAME-FILE is non-nil, do not move to a different Info file."
   (interactive)
   (let ((node (Info-extract-pointer "up")))
-    (and same-file
+    (and (or same-file (not (stringp Info-current-file)))
         (string-match "^(" node)
         (error "Up node is in another Info file"))
     (Info-goto-node node))
@@ -1100,14 +1148,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)
@@ -1121,7 +1170,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.
@@ -1218,7 +1267,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\\* +\\("
@@ -1229,12 +1279,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
@@ -1246,11 +1294,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
@@ -1264,7 +1310,7 @@ NAME may be an abbreviation of the reference name."
                                nil t))))))
 
 
-(defun Info-menu (menu-item)
+(defun Info-menu (menu-item &optional fork)
   "Go to node for menu item named (or abbreviated) NAME.
 Completion is allowed, and the menu item point is on is the default."
   (interactive
@@ -1273,7 +1319,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))
@@ -1284,9 +1331,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)
@@ -1294,7 +1339,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 ""
@@ -1302,40 +1347,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))))
-       (list item))))
+              ;; 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)))
-  
+  (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.
@@ -1354,11 +1401,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))
@@ -1370,36 +1418,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)
@@ -1428,12 +1478,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"))))
 
@@ -1441,9 +1493,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
@@ -1495,8 +1549,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 ()
@@ -1514,11 +1569,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)
@@ -1533,7 +1589,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))
@@ -1585,7 +1642,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\".
@@ -1623,15 +1680,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)))
@@ -1662,7 +1715,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"
@@ -1722,15 +1775,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."
@@ -1753,7 +1806,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)
@@ -1850,6 +1903,7 @@ If no reference to follow, moves to the next node, or up if none."
   (define-key Info-mode-map "s" 'Info-search)
   ;; For consistency with Rmail.
   (define-key Info-mode-map "\M-s" 'Info-search)
+  (define-key Info-mode-map "\M-n" 'clone-buffer)
   (define-key Info-mode-map "t" 'Info-top-node)
   (define-key Info-mode-map "u" 'Info-up)
   (define-key Info-mode-map "," 'Info-index-next)
@@ -1858,30 +1912,49 @@ 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]))
+                 "Menu for info files."
+                 '("Info"
+                   ["Up" Info-up (Info-check-pointer "up")
+                    :help "Go up in the Info tree"]
+                   ["Next" Info-next (Info-check-pointer "next")
+                    :help "Go to the next node"]
+                   ["Previous" Info-prev (Info-check-pointer "prev[ious]*")
+                    :help "Go to the previous node"]
+                   ["Backward" Info-backward-node t
+                    :help "Go backward one node, considering all as a sequence"]
+                   ["Forward" Info-forward-node t
+                    :help "Go forward one node, considering all as a sequence"]
+                   ["Top" Info-top-node t
+                    :help "Go to top node of file"]
+                   ["Final node" Info-final-node t
+                    :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 t
+                    :help "Search for regular expression in this Info file"]
+                   ["Goto node..." Info-goto-node t
+                    :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 t
+                     :help "Look for a string in the index items"]
+                    ["Next Matching Item" Info-index-next t
+                     :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)
@@ -1893,13 +1966,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)))
@@ -1910,7 +1983,7 @@ If no reference to follow, moves to the next node, or up if none."
          (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
@@ -1930,7 +2003,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)))
@@ -1950,12 +2023,12 @@ If no reference to follow, moves to the next node, or up if none."
 (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.
 
@@ -1988,7 +2061,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.
@@ -2025,9 +2098,20 @@ Advanced commands:
   ;; This is for the sake of the invisible text we use handling titles.
   (make-local-variable 'line-move-ignore-invisible)
   (setq line-move-ignore-invisible t)
+  (add-hook (make-local-hook 'clone-buffer-hook) 'Info-clone-buffer-hook nil t)
   (Info-set-mode-line)
   (run-hooks 'Info-mode-hook))
 
+(defun Info-clone-buffer-hook ()
+  (when (bufferp Info-tag-table-buffer)
+    (setq Info-tag-table-buffer
+         (with-current-buffer Info-tag-table-buffer (clone-buffer)))
+    (let ((m Info-tag-table-marker))
+      (when (and (markerp m) (marker-position m))
+       (setq Info-tag-table-marker
+             (with-current-buffer Info-tag-table-buffer
+               (copy-marker (marker-position m))))))))
+
 (defvar Info-edit-map nil
   "Local keymap used within `e' command of Info.")
 (if Info-edit-map
@@ -2060,7 +2144,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."
@@ -2092,7 +2176,7 @@ 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))
@@ -2126,12 +2210,10 @@ The locations are of the format used in Info-history, i.e.
       (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)))
+       (setq where (cons (list Info-current-file
+                               (match-string-no-properties 1)
+                               0)
+                         where)))
       where)))
 
 ;;;###autoload
@@ -2170,7 +2252,7 @@ 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'."
@@ -2185,10 +2267,25 @@ the variable `Info-file-list-for-emacs'."
          (t
           (Info-goto-emacs-command-node command)))))
 \f
+(defface Info-title-1-face
+  '((t (:family "helv" :height 240 :weight bold)))
+  "Face for Info titles at level 1."
+  :group 'info)
+
+(defface Info-title-2-face
+  '((t (:family "helv" :height 180 :weight bold)))
+  "Face for Info titles at level 2."
+  :group 'info)
+
+(defface Info-title-3-face
+  '((t (:family "helv" :height 160 :weight bold)))
+  "Face for Info titles at level 3."
+  :group 'info)
+
 (defcustom Info-title-face-alist
-  '((?* bold underline)
-    (?= bold-italic underline)
-    (?- italic underline))
+  '((?* (face (variable-pitch bold) display (height (+ 4))))
+    (?= (face (variable-pitch bold) display (height (+ 3))))
+    (?- (face (variable-pitch bold) display (height (+ 2)))))
   "*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))
@@ -2215,16 +2312,20 @@ The alist key is the character the title is underlined with (?*, ?= or ?-)."
                               'mouse-face 'highlight))))
       (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
@@ -2241,7 +2342,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))
@@ -2350,32 +2451,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.
@@ -2385,9 +2486,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
@@ -2442,6 +2543,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