("Czech"): Fix the documentation.
[bpt/emacs.git] / lisp / info.el
index 1add6ed..9ce5bb7 100644 (file)
@@ -1,7 +1,7 @@
-;;; info.el --- info package for Emacs.
+;;; info.el --- info package for Emacs
 
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
+;;  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help
@@ -61,9 +61,9 @@ The Lisp code is executed when the node is selected.")
   :group 'info)
 
 (defface info-node
-  '((((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)))
+  '((((class color) (background light)) (:foreground "brown" :weight bold :slant italic))
+    (((class color) (background dark)) (:foreground "white" :weight bold :slant italic))
+    (t (:weight bold :slant italic)))
   "Face for Info node names."
   :group 'info)
 
@@ -74,9 +74,9 @@ The Lisp code is executed when the node is selected.")
   :group 'info)
 
 (defface info-xref
-  '((((class color) (background light)) (:foreground "magenta4" :bold t))
-    (((class color) (background dark)) (:foreground "cyan" :bold t))
-    (t (:bold t)))
+  '((((class color) (background light)) (:foreground "magenta4" :weight bold))
+    (((class color) (background dark)) (:foreground "cyan" :weight bold))
+    (t (:weight bold)))
   "Face for Info cross-references."
   :group 'info)
 
@@ -132,7 +132,8 @@ a version of Emacs without installing it.")
 
 (defcustom Info-additional-directory-list nil
   "List of additional directories to search for Info documentation files.
-These directories are not searched for merging the `dir' file."
+These directories are searched after those in `Info-directory-list', and
+they are not searched for merging the `dir' file."
   :type '(repeat directory)
   :group 'info)
 
@@ -234,10 +235,10 @@ Because the SUFFIXes are tried in order, the empty string should
 be last in the list.")
 
 ;; Concatenate SUFFIX onto FILENAME.  SUFFIX should start with a dot.
-;; First, on ms-dos, delete some of the extension in FILENAME
-;; to make room.
-(defun info-insert-file-contents-1 (filename suffix)
-  (if (not (eq system-type 'ms-dos))
+;; First, on MS-DOS with no long file names support, delete some of
+;; the extension in FILENAME to make room.
+(defun info-insert-file-contents-1 (filename suffix lfn)
+  (if lfn      ; long file names are supported
       (concat filename suffix)
     (let* ((sans-exts (file-name-sans-extension filename))
           ;; How long is the extension in FILENAME (not counting the dot).
@@ -263,9 +264,13 @@ be last in the list.")
 (defun info-insert-file-contents (filename &optional visit)
   "Insert the contents of an info file in the current buffer.
 Do the right thing if the file has been compressed or zipped."
-  (let ((tail Info-suffix-list)
-       fullname decoder)
-    (if (file-exists-p filename)
+  (let* ((tail Info-suffix-list)
+        (lfn (or (not (fboundp 'msdos-long-file-names))
+                 (msdos-long-file-names)))
+        (check-short (and (fboundp 'msdos-long-file-names)
+                          lfn))
+        fullname decoder done)
+    (if (info-file-exists-p filename)
        ;; FILENAME exists--see if that name contains a suffix.
        ;; If so, set DECODE accordingly.
        (progn
@@ -277,14 +282,23 @@ Do the right thing if the file has been compressed or zipped."
          (setq fullname filename
                decoder (cdr (car tail))))
       ;; Try adding suffixes to FILENAME and see if we can find something.
-      (while (and tail
-                 (not (info-file-exists-p (info-insert-file-contents-1
-                                           filename (car (car tail))))))
+      (while (and tail (not done))
+       (setq fullname (info-insert-file-contents-1 filename
+                                                   (car (car tail)) lfn))
+       (if (info-file-exists-p fullname)
+           (setq done t
+                 ;; If we found a file with a suffix, set DECODER
+                 ;; according to the suffix.
+                 decoder (cdr (car tail)))
+         ;; When the MS-DOS port runs on Windows, we need to check
+         ;; the short variant of a long file name as well.
+         (when check-short
+           (setq fullname (info-insert-file-contents-1 filename
+                                                       (car (car tail)) nil))
+           (if (info-file-exists-p fullname)
+               (setq done t
+                     decoder (cdr (car tail))))))
        (setq tail (cdr tail)))
-      ;; If we found a file with a suffix, set DECODER according to the suffix
-      ;; and set FULLNAME to the file's actual name.
-      (setq fullname (info-insert-file-contents-1 filename (car (car tail)))
-           decoder (cdr (car tail)))
       (or tail
          (error "Can't find %s or any compressed version of it" filename)))
     ;; check for conflict with jka-compr
@@ -312,8 +326,7 @@ Do the right thing if the file has been compressed or zipped."
          (source (expand-file-name "info/" source-directory))
          (sibling (if installation-directory
                       (expand-file-name "info/" installation-directory)
-                    (if (and (memq system-type '(ms-dos windows-nt))
-                             invocation-directory)
+                    (if invocation-directory
                         (let ((infodir (expand-file-name
                                         "../info/"
                                         invocation-directory)))
@@ -460,16 +473,24 @@ it says do not attempt further (recursive) error recovery."
               (setq temp-downcase
                     (expand-file-name (downcase filename) (car dirs)))
               ;; Try several variants of specified name.
-              (let ((suffix-list Info-suffix-list))
+              (let ((suffix-list Info-suffix-list)
+                   (lfn (or (not (fboundp 'msdos-long-file-names))
+                            (msdos-long-file-names))))
                 (while (and suffix-list (not found))
                   (cond ((info-file-exists-p
                           (info-insert-file-contents-1
-                           temp (car (car suffix-list))))
+                           temp (car (car suffix-list)) lfn))
                          (setq found temp))
                         ((info-file-exists-p
                           (info-insert-file-contents-1
-                           temp-downcase (car (car suffix-list))))
-                         (setq found temp-downcase)))
+                           temp-downcase (car (car suffix-list)) lfn))
+                         (setq found temp-downcase))
+                       ((and (fboundp 'msdos-long-file-names)
+                             lfn
+                             (info-file-exists-p
+                              (info-insert-file-contents-1
+                               temp (car (car suffix-list)) nil)))
+                        (setq found temp)))
                   (setq suffix-list (cdr suffix-list))))
               (setq dirs (cdr dirs)))))
         (if found
@@ -487,12 +508,12 @@ it says do not attempt further (recursive) error recovery."
 (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'."
+else defaults to \"Top\"."
   (interactive
    (list (if current-prefix-arg
             (completing-read "Node name: " (Info-build-node-completions)
-                             nil t "Top")
-          "Top")))
+                             nil t "Top"))))
+  (unless nodename (setq nodename "Top"))
   (info-initialize)
   (Info-mode)
   (set (make-local-variable 'Info-current-file) t)
@@ -588,7 +609,7 @@ a case-insensitive match is tried."
               (erase-buffer)
               (if (eq filename t)
                   (Info-insert-dir)
-                (info-insert-file-contents filename t)
+                (info-insert-file-contents filename nil)
                 (setq default-directory (file-name-directory filename)))
               (set-buffer-modified-p nil)
               ;; See whether file has a tag table.  Record the location if yes.
@@ -643,7 +664,7 @@ a case-insensitive match is tried."
           ;; Search file for a suitable node.
          (let ((guesspos (point-min))
                (regexp (concat "\\(Node:\\|Ref:\\) *\\("
-                               (if (stringp nodename) 
+                               (if (stringp nodename)
                                    (regexp-quote nodename)
                                  "")
                                "\\) *[,\t\n\177]"))
@@ -880,7 +901,6 @@ a case-insensitive match is tried."
       (while buffers
        (kill-buffer (car buffers))
        (setq buffers (cdr buffers)))
-      (if Info-fontify (Info-fontify-menu-headers))
       (goto-char (point-min))
       (if problems
          (message "Composing main Info directory...problems encountered, see `*Messages*'")
@@ -930,6 +950,8 @@ a case-insensitive match is tried."
          (info-insert-file-contents lastfilename)
          (set-buffer-modified-p nil)
          (setq Info-current-subfile lastfilename)))
+    ;; Widen in case we are in the same subfile as before.
+    (widen)
     (goto-char (point-min))
     (if (looking-at "\^_")
        (forward-char 1)
@@ -977,7 +999,8 @@ Bind this in case the user sets it to nil."
        (if Info-fontify (Info-fontify-node))
        (if Info-use-header-line
            (Info-setup-header-line)
-         (setq Info-header-line nil))
+         (setq Info-header-line nil)
+         (setq header-line-format nil)) ; so the header line isn't displayed
        (run-hooks 'Info-selection-hook)))))
 
 (defun Info-set-mode-line ()
@@ -1016,7 +1039,11 @@ Bind this in case the user sets it to nil."
 ;; of the sort that is found in pointers in nodes.
 
 (defun Info-goto-node (nodename &optional fork)
-  "Go to info node named NAME.  Give just NODENAME or (FILENAME)NODENAME.
+  "Go to info node named NODENAME.  Give just NODENAME or (FILENAME)NODENAME.
+If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
+FILENAME; otherwise, NODENAME should be in the current Info file (or one of
+its sub-files).
+Completion is available, but only for node names in the current Info file.
 If FORK is non-nil (interactively with a prefix arg), show the node in
 a new info buffer.
 If FORK is a string, it is the name to use for the new buffer."
@@ -1101,7 +1128,7 @@ If FORK is a string, it is the name to use for the new buffer."
                            (cons (list (match-string-no-properties 1))
                                  compl))))))))
        (setq compl (cons '("*") compl))
-       (setq Info-current-file-completions compl))))
+       (set (make-local-variable 'Info-current-file-completions) compl))))
 \f
 (defun Info-restore-point (hl)
   "If this node has been visited, restore the point value when we left."
@@ -1172,7 +1199,6 @@ If FORK is a string, it is the name to use for the new buffer."
                  (message "Searching subfile %s..." (cdr (car list)))
                  (Info-read-subfile (car (car list)))
                  (setq list (cdr list))
-;;;            (goto-char (point-min))
                  (if (re-search-forward regexp nil t)
                      (setq found (point) list ())))
                (if found
@@ -1327,8 +1353,9 @@ FOOTNOTENAME may be an abbreviation of the reference name."
          (setq default (car (car completions))))
      (if completions
         (let ((input (completing-read (if default
-                                          (concat "Follow reference named: ("
-                                                  default ") ")
+                                          (concat
+                                           "Follow reference named: (default "
+                                           default ") ")
                                         "Follow reference named: ")
                                       completions nil t)))
           (list (if (equal input "")
@@ -1367,12 +1394,7 @@ FOOTNOTENAME may be an abbreviation of the reference name."
              (buffer-substring-no-properties beg (1- (point)))
            (skip-chars-forward " \t\n")
            (Info-following-node-name (if multi-line "^.,\t" "^.,\t\n"))))
-    (while (setq i (string-match "\n" str i))
-      (aset str i ?\ ))
-    ;; Collapse multiple spaces.
-    (while (string-match "  +" str)
-      (setq str (replace-match " " t t str)))
-    str))
+    (replace-regexp-in-string "[ \n]+" " " str)))
 
 ;; No one calls this.
 ;;(defun Info-menu-item-sequence (list)
@@ -1381,54 +1403,69 @@ FOOTNOTENAME may be an abbreviation of the reference name."
 ;;    (setq list (cdr list))))
 
 (defvar Info-complete-menu-buffer)
+(defvar Info-complete-next-re nil)
+(defvar Info-complete-cache nil)
 
 (defun Info-complete-menu-item (string predicate action)
-  (let ((completion-ignore-case t)
-       (case-fold-search t))
-    (cond ((eq action nil)
-          (let (completions
-                (pattern (concat "\n\\* +\\("
-                                 (regexp-quote string)
-                                 "[^:\t\n]*\\):")))
-            (save-excursion
-              (set-buffer Info-complete-menu-buffer)
-              (goto-char (point-min))
-              (search-forward "\n* Menu:")
-              (while (re-search-forward pattern nil t)
-                (setq completions
-                      (cons (cons (match-string-no-properties 1)
-                                  (match-beginning 1))
-                            completions))))
-            (try-completion string completions predicate)))
-         ((eq action t)
-          (let (completions
-                (pattern (concat "\n\\* +\\("
-                                 (regexp-quote string)
-                                 "[^:\t\n]*\\):")))
-            (save-excursion
-              (set-buffer Info-complete-menu-buffer)
-              (goto-char (point-min))
-              (search-forward "\n* Menu:")
-              (while (re-search-forward pattern nil t)
-                (setq completions (cons (cons
-                                         (match-string-no-properties 1)
-                                         (match-beginning 1))
-                                        completions))))
-            (all-completions string completions predicate)))
-         (t
-          (save-excursion
-            (set-buffer Info-complete-menu-buffer)
-            (goto-char (point-min))
-            (search-forward "\n* Menu:")
-            (re-search-forward (concat "\n\\* +"
-                                       (regexp-quote string)
-                                       ":")
-                               nil t))))))
+  ;; This uses two dynamically bound variables:
+  ;; - `Info-complete-menu-buffer' which contains the buffer in which
+  ;; is the menu of items we're trying to complete.
+  ;; - `Info-complete-next-re' which, if non-nil, indicates that we should
+  ;; also look for menu items in subsequent nodes as long as those
+  ;; nodes' names match `Info-complete-next-re'.  This feature is currently
+  ;; only used for completion in Info-index.
+  (save-excursion
+    (set-buffer Info-complete-menu-buffer)
+    (let ((completion-ignore-case t)
+         (case-fold-search t)
+         (orignode Info-current-node)
+         nextnode)
+      (goto-char (point-min))
+      (search-forward "\n* Menu:")
+      (if (not (memq action '(nil t)))
+         (re-search-forward
+          (concat "\n\\* +" (regexp-quote string) ":") nil t)
+       (let ((pattern (concat "\n\\* +\\("
+                              (regexp-quote string)
+                              "[^:\t\n]*\\):"))
+             completions)
+         ;; Check the cache.
+         (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
+                  (equal (nth 1 Info-complete-cache) Info-current-node)
+                  (equal (nth 2 Info-complete-cache) Info-complete-next-re)
+                  (let ((prev (nth 3 Info-complete-cache)))
+                    (eq t (compare-strings string 0 (length prev)
+                                           prev 0 nil t))))
+             ;; We can reuse the previous list.
+             (setq completions (nth 4 Info-complete-cache))
+           ;; The cache can't be used.
+           (while
+               (progn
+                 (while (re-search-forward pattern nil t)
+                   (push (cons (match-string-no-properties 1)
+                               (match-beginning 1))
+                         completions))
+                 ;; Check subsequent nodes if applicable.
+                 (and Info-complete-next-re
+                      (setq nextnode (Info-extract-pointer "next" t))
+                      (string-match Info-complete-next-re nextnode)))
+             (Info-goto-node nextnode))
+           ;; Go back to the start node (for the next completion).
+           (unless (equal Info-current-node orignode)
+             (Info-goto-node orignode))
+           ;; Update the cache.
+           (setq Info-complete-cache
+                 (list Info-current-file Info-current-node
+                       Info-complete-next-re string completions)))
+         (if action
+             (all-completions string completions predicate)
+           (try-completion string completions predicate)))))))
 
 
 (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.
+  "Go to the node pointed to by the menu item named (or abbreviated) MENU-ITEM.
+The menu item should one of those listed in the current node's menu.
+Completion is allowed, and the default menu item is the one point is on.
 If FORK is non-nil (interactively with a prefix arg), show the node in
 a new info buffer.  If FORK is a string, it is the name to use for the
 new buffer."
@@ -1746,7 +1783,8 @@ parent node."
                 (search-forward "\n* Menu:"
                                 current-point
                                 t)))))
-    (if (or virtual-end (pos-visible-in-window-p (point-min)))
+    (if (or virtual-end 
+           (pos-visible-in-window-p (point-min) nil t))
        (Info-last-preorder)
       (scroll-down))))
 
@@ -1789,38 +1827,49 @@ parent node."
            (error "No cross references in this node")
          (Info-prev-reference t)))))
 
+(defun Info-goto-index ()
+  (Info-goto-node "Top")
+  (or (search-forward "\n* menu:" nil t)
+      (error "No index"))
+  (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
+      (error "No index"))
+  (goto-char (match-beginning 1))
+  ;; Protect Info-history so that the current node (Top) is not added to it.
+  (let ((Info-history nil))
+    (Info-goto-node (Info-extract-menu-node-name))))
+
 (defun Info-index (topic)
   "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
+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\".
 If there are no exact matches to the specified topic, this chooses
 the first match which is a case-insensitive substring of a topic.
 Use the `,' command to see the other matches.
 Give a blank topic name to go to the Index node itself."
-  (interactive "sIndex topic: ")
+  (interactive
+   (list
+    (let ((Info-complete-menu-buffer (clone-buffer))
+         (Info-complete-next-re "\\<Index\\>"))
+      (unwind-protect
+         (with-current-buffer Info-complete-menu-buffer
+           (Info-goto-index)
+           (completing-read "Index topic: " 'Info-complete-menu-item))
+       (kill-buffer Info-complete-menu-buffer)))))
   (let ((orignode Info-current-node)
        (rnode nil)
        (pattern (format "\n\\* +\\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)"
                         (regexp-quote topic)))
        node
        (case-fold-search t))
-    (Info-goto-node "Top")
-    (or (search-forward "\n* menu:" nil t)
-       (error "No index"))
-    (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
-       (error "No index"))
-    (goto-char (match-beginning 1))
-    ;; Here, and subsequently in this function,
-    ;; we bind Info-history to nil for internal node-switches
-    ;; so that we don't put junk in the history.
-    ;; In the first Info-goto-node call, above, we do update the history
-    ;; because that is what the user's previous node choice into it.
-    (let ((Info-history nil))
-      (Info-goto-node (Info-extract-menu-node-name)))
+    (Info-goto-index)
     (or (equal topic "")
        (let ((matches nil)
              (exact nil)
+             ;; We bind Info-history to nil for internal node-switches so
+             ;; that we don't put junk in the history.  In the first
+             ;; Info-goto-index call, above, we do update the history
+             ;; because that is what the user's previous node choice into it.
              (Info-history nil)
              found)
          (while
@@ -2095,6 +2144,8 @@ If no reference to follow, moves to the next node, or up if none."
      :help "Look for another occurrence of previous item"])
    ["Edit" Info-edit :help "Edit contents of this node"
     :active Info-enable-edit]
+   ["Copy Node Name" Info-copy-current-node-name
+    :help "Copy the name of the current node into the kill ring"]
    ["Exit" Info-exit :help "Stop reading Info"]))
 
 
@@ -2126,8 +2177,7 @@ If no reference to follow, moves to the next node, or up if none."
        ;; Update menu menu.
        (let* ((Info-complete-menu-buffer (current-buffer))
               (items (nreverse (condition-case nil
-                                   (Info-complete-menu-item
-                                    "" (lambda (e) t) t)
+                                   (Info-complete-menu-item "" nil t)
                                  (error nil))))
               entries current
               (number 0))
@@ -2142,7 +2192,7 @@ If no reference to follow, moves to the next node, or up if none."
          (if items
              (setq entries (cons ["Other..." Info-menu t] entries)))
          (or entries
-             (setq entries (list ["No menu" nil nil])))
+             (setq entries (list ["No menu" nil nil] nil :active)))
          (easy-menu-change '("Info") "Menu Item" (nreverse entries)))
        ;; Update reference menu.  Code stolen from `Info-follow-reference'.
        (let ((items nil)
@@ -2174,7 +2224,7 @@ If no reference to follow, moves to the next node, or up if none."
              (setq entries (cons ["Other..." Info-follow-reference t]
                                  entries)))
          (or entries
-             (setq entries (list ["No references" nil nil])))
+             (setq entries (list ["No references" nil nil] nil :active)))
          (easy-menu-change '("Info") "Reference" (nreverse entries)))
        ;; Update last seen node.
        (setq Info-menu-last-node (list Info-current-file Info-current-node)))
@@ -2182,8 +2232,25 @@ If no reference to follow, moves to the next node, or up if none."
     (error (ding))))
 
 \f
+(defun Info-copy-current-node-name ()
+  "Put the name of the current info node into the kill ring.
+The name of the info file is prepended to the node name in parentheses."
+  (interactive)
+  (unless Info-current-node
+    (error "No current info node"))
+  (kill-new
+   (concat "("
+          (file-name-nondirectory
+           (if (stringp Info-current-file)
+               Info-current-file
+             (or buffer-file-name "")))
+          ")"
+          Info-current-node)))
+
+\f
 ;; Info mode is suitable only for specially formatted data.
 (put 'Info-mode 'mode-class 'special)
+(put 'Info-mode 'no-clone-indirect t)
 
 (defun Info-mode ()
   "Info mode provides commands for browsing through the Info documentation tree.
@@ -2205,7 +2272,7 @@ Selecting other nodes:
 \\[Info-prev]  Move to the \"previous\" node of this node.
 \\[Info-up]    Move \"up\" from this node.
 \\[Info-menu]  Pick menu item specified by name (or abbreviation).
-       Picking a menu item causes another node to be selected.
+         Picking a menu item causes another node to be selected.
 \\[Info-directory]     Go to the Info directory node.
 \\[Info-follow-reference]      Follow a cross reference.  Reads name of reference.
 \\[Info-last]  Move to the last node you were at.
@@ -2218,12 +2285,13 @@ Selecting other nodes:
 
 Moving within a node:
 \\[Info-scroll-up]     Normally, scroll forward a full screen.
-Once you scroll far enough in a node that its menu appears on the screen
-but after point, the next scroll moves into its first subnode.
-When after all menu items (or if their is no menu), move up to
-the parent node.
+         Once you scroll far enough in a node that its menu appears on the
+         screen but after point, the next scroll moves into its first
+         subnode.  When after all menu items (or if there 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.
+         already visible, try to go to the previous menu entry, or up
+         if there is none.
 \\[beginning-of-buffer]        Go to beginning of node.
 
 Advanced commands:
@@ -2232,10 +2300,10 @@ Advanced commands:
 1      Pick first item in node's menu.
 2, 3, 4, 5   Pick second ... fifth item in node's menu.
 \\[Info-goto-node]     Move to node specified by name.
-       You may include a filename as well, as (FILENAME)NODENAME.
+         You may include a filename as well, as (FILENAME)NODENAME.
 \\[universal-argument] \\[info]        Move to new Info file with completion.
 \\[Info-search]        Search through this Info file for specified regexp,
-       and select the node in which the next occurrence is found.
+         and select the node in which the next occurrence is found.
 \\[Info-next-reference]        Move cursor to next cross-reference or menu item.
 \\[Info-prev-reference]        Move cursor to previous cross-reference or menu item."
   (kill-all-local-variables)
@@ -2268,12 +2336,14 @@ Advanced commands:
 (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))))))))
+         (with-current-buffer Info-tag-table-buffer (clone-buffer))))
+  (let ((m Info-tag-table-marker))
+    (when (markerp m)
+      (setq Info-tag-table-marker
+           (if (and (marker-position m) (bufferp Info-tag-table-buffer))
+               (with-current-buffer Info-tag-table-buffer
+                 (copy-marker (marker-position m)))
+             (make-marker))))))
 
 (defvar Info-edit-map (let ((map (make-sparse-keymap)))
                        (set-keymap-parent map text-mode-map)
@@ -2326,14 +2396,26 @@ 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" ("mh" . "mh-e") "sc" "message"
-    ("dired" . "dired-x") ("c" . "ccmode") "viper" "vip"
+  '("ediff" "eudc" "forms" "gnus" "info" ("mh" . "mh-e")
+    "sc" "message" ("dired" . "dired-x") "viper" "vip" "idlwave"
+    ("c" . "ccmode") ("c++" . "ccmode") ("objc" . "ccmode")
+    ("java" . "ccmode") ("idl" . "ccmode") ("pike" . "ccmode")
     ("skeleton" . "autotype") ("auto-insert" . "autotype")
     ("copyright" . "autotype") ("executable" . "autotype")
     ("time-stamp" . "autotype") ("quickurl" . "autotype")
     ("tempo" . "autotype") ("hippie-expand" . "autotype")
-    ("cvs" . "pcl-cvs")
-    "ebrowse" "eshell" "cl" "idlwave" "reftex" "speedbar" "widget" "woman")
+    ("cvs" . "pcl-cvs") ("ada" . "ada-mode") "calc"
+    ("calcAlg" . "calc") ("calcDigit" . "calc") ("calcVar" . "calc")
+    "ebrowse" "eshell" "cl" "reftex" "speedbar" "widget" "woman"
+    ("mail-header" . "emacs-mime") ("mail-content" . "emacs-mime")
+    ("mail-encode" . "emacs-mime") ("mail-decode" . "emacs-mime")
+    ("rfc2045" . "emacs-mime")
+    ("rfc2231" . "emacs-mime")  ("rfc2047" . "emacs-mime")
+    ("rfc2045" . "emacs-mime") ("rfc1843" . "emacs-mime")
+    ("ietf-drums" . "emacs-mime")  ("quoted-printable" . "emacs-mime")
+    ("binhex" . "emacs-mime") ("uudecode" . "emacs-mime")
+    ("mailcap" . "emacs-mime") ("mm" . "emacs-mime")
+    ("mml" . "emacs-mime"))
   "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.
@@ -2494,80 +2576,99 @@ the variable `Info-file-list-for-emacs'."
                           'face 'info-menu-header)))))
 
 (defun Info-fontify-node ()
-  (save-excursion
-    (let ((buffer-read-only nil)
-         (case-fold-search t))
-      (goto-char (point-min))
-      (when (looking-at "^File: [^,: \t]+,?[ \t]+")
-       (goto-char (match-end 0))
-       (while (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
+  ;; Only fontify the node if it hasn't already been done.  [We pass in
+  ;; LIMIT arg to `next-property-change' because it seems to search past
+  ;; (point-max).]
+  (unless (and (< (next-property-change (point-min) nil (point-max))
+                 (point-max))
+              ;; But do put the text properties if the local-map property
+              ;; is inconsistent with Info-use-header-line's value.
+              (eq
+               (= (next-single-property-change
+                   (point-min) 'local-map nil (point-max))
+                  (point-max))
+               (null Info-use-header-line)))
+    (save-excursion
+      (let ((buffer-read-only nil)
+           (case-fold-search t))
+       (goto-char (point-min))
+       (when (looking-at "^File: [^,: \t]+,?[ \t]+")
          (goto-char (match-end 0))
-         (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 "Go to 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)
-       (let ((c (preceding-char))
-             face)
-         (cond ((= c ?*) (setq face 'Info-title-1-face))
-               ((= c ?=) (setq face 'Info-title-2-face))
-               ((= c ?-) (setq face 'Info-title-3-face))
-               (t        (setq face 'Info-title-4-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.
-       (when (memq (framep (selected-frame)) '(x pc w32 mac))
-         (add-text-properties (match-end 1) (match-end 2)
-                              '(invisible t intangible t))
-         (add-text-properties (1- (match-end 1)) (match-end 2)
-                              '(intangible t))))
-      (goto-char (point-min))
-      (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t)
-       (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
-           nil
-         (add-text-properties (match-beginning 1) (match-end 1)
-                              '(face info-xref
-                                mouse-face highlight
-                                help-echo "mouse-2: go to this node"))))
-      (goto-char (point-min))
-      (if (and (search-forward "\n* Menu:" nil t)
-              (not (string-match "\\<Index\\>" Info-current-node))
-              ;; Don't take time to annotate huge menus
-              (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
-         (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
-                 (put-text-property (match-beginning 0)
-                                    (1+ (match-beginning 0))
-                                    'face 'info-menu-5))
-             (add-text-properties (match-beginning 1) (match-end 1)
-                                  '(face info-xref
-                                    mouse-face highlight
-                                    help-echo "mouse-2: go to this node")))))
-      (Info-fontify-menu-headers)
-      (set-buffer-modified-p nil))))
+         (while (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
+           (goto-char (match-end 0))
+           (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 "Go to node "
+                                          (buffer-substring nbeg nend)))
+               ;; Don't bind mouse events on the header line if we
+               ;; aren't going to display the header line.
+               (when Info-use-header-line
+                 (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 down-mouse-1] fun)
+                       (define-key keymap [header-line down-mouse-2] fun)
+                       (put-text-property tbeg nend 'local-map keymap)))))
+               (if (not Info-use-header-line)
+                   ;; In case they switched Info-use-header-line off
+                   ;; in the middle of an Info session, some text
+                   ;; properties may have been left lying around from
+                   ;; past visits of this node.  Remove them.
+                   (remove-text-properties tbeg nend '(local-map nil)))
+                 ))))
+       (goto-char (point-min))
+       (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
+                                 nil t)
+         (let ((c (preceding-char))
+               face)
+           (cond ((= c ?*) (setq face 'Info-title-1-face))
+                 ((= c ?=) (setq face 'Info-title-2-face))
+                 ((= c ?-) (setq face 'Info-title-3-face))
+                 (t        (setq face 'Info-title-4-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.
+         (when (memq (framep (selected-frame)) '(x pc w32 mac))
+           (add-text-properties (match-beginning 2) (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
+             nil
+           (add-text-properties (match-beginning 1) (match-end 1)
+                                '(face info-xref
+                                  mouse-face highlight
+                                  help-echo "mouse-2: go to this node"))))
+       (goto-char (point-min))
+       (if (and (search-forward "\n* Menu:" nil t)
+                (not (string-match "\\<Index\\>" Info-current-node))
+                ;; Don't take time to annotate huge menus
+                (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
+           (let ((n 0))
+             (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t)
+               (setq n (1+ n))
+               (if (zerop (% n 3)) ; visual aids to help with 1-9 keys
+                   (put-text-property (match-beginning 0)
+                                      (1+ (match-beginning 0))
+                                      'face 'info-menu-5))
+               (add-text-properties (match-beginning 1) (match-end 1)
+                                    '(face info-xref
+                                      mouse-face highlight
+                                      help-echo "mouse-2: go to this node")))))
+       (Info-fontify-menu-headers)
+       (set-buffer-modified-p nil)))))
 \f
 
 ;; When an Info buffer is killed, make sure the associated tags buffer