]> code.delx.au - gnu-emacs/blobdiff - lisp/info.el
(forms--change-commands): Use command remapping instead of
[gnu-emacs] / lisp / info.el
index 5bd9504304ac11a53328b8d11f3db5de9a446bec..ed323d6e7f090cb707ecc51ce62c7172e8189bd3 100644 (file)
@@ -534,6 +534,40 @@ else defaults to \"Top\"."
   (set (make-local-variable 'Info-current-file) t)
   (Info-find-node-2 nil nodename))
 
+;; It's perhaps a bit nasty to kill the *info* buffer to force a re-read,
+;; but at least it keeps this routine (which is only for the benefit of
+;; makeinfo-buffer) out of the way of normal operations.
+;;
+(defun Info-revert-find-node (filename nodename)
+  "Go to an info node FILENAME and NODENAME, re-reading disk contents.
+When *info* is already displaying FILENAME and NODENAME, the window position
+is preserved, if possible."
+  (pop-to-buffer "*info*")
+  (let ((old-filename Info-current-file)
+       (old-nodename Info-current-node)
+       (pcolumn      (current-column))
+       (pline        (count-lines (point-min) (line-beginning-position)))
+       (wline        (count-lines (point-min) (window-start)))
+       (old-history  Info-history)
+       (new-history (and Info-current-file
+                         (list Info-current-file Info-current-node (point)))))
+    (kill-buffer (current-buffer))
+    (Info-find-node filename nodename)
+    (setq Info-history old-history)
+    (if (and (equal old-filename Info-current-file)
+            (equal old-nodename Info-current-node))
+       (progn
+         ;; note goto-line is no good, we want to measure from point-min
+         (beginning-of-buffer)
+         (forward-line wline)
+         (set-window-start (selected-window) (point))
+         (beginning-of-buffer)
+         (forward-line pline)
+         (move-to-column pcolumn))
+      ;; only add to the history when coming from a different file+node
+      (if new-history
+         (setq Info-history (cons new-history Info-history))))))
+
 (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.
@@ -774,14 +808,13 @@ a case-insensitive match is tried."
                    (append Info-directory-list
                            Info-additional-directory-list)
                  Info-directory-list))
+         (dir-file-attrs nil)
          ;; Bind this in case the user sets it to nil.
          (case-fold-search t)
          ;; This is set non-nil if we find a problem in some input files.
          problems
          buffers buffer others nodes dirs-done)
 
-      (setq Info-dir-file-attributes nil)
-
       ;; Search the directory list for the directory file.
       (while dirs
        (let ((truename (file-truename (expand-file-name (car dirs)))))
@@ -812,17 +845,19 @@ a case-insensitive match is tried."
                      (condition-case nil
                          (progn
                            (insert-file-contents file)
-                           (make-local-variable 'Info-dir-file-name)
-                           (setq Info-dir-file-name file)
+                           (set (make-local-variable 'Info-dir-file-name)
+                                file)
                            (push (current-buffer) buffers)
-                           (push (cons file attrs) Info-dir-file-attributes))
+                           (push (cons file attrs) dir-file-attrs))
                        (error (kill-buffer (current-buffer))))))))
-         (or (cdr dirs) (setq Info-dir-contents-directory
-                              (file-name-as-directory (car dirs))))
+         (unless (cdr dirs)
+           (set (make-local-variable '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
       ;; others.  Yes, that is really what this is supposed to do.
       ;; The definition of `Info-directory-list' puts it first on that
@@ -900,8 +935,9 @@ a case-insensitive match is tried."
       (goto-char (point-min))
       (if problems
          (message "Composing main Info directory...problems encountered, see `*Messages*'")
-       (message "Composing main Info directory...done")))
-    (setq Info-dir-contents (buffer-string)))
+       (message "Composing main Info directory...done"))
+      (set (make-local-variable 'Info-dir-contents) (buffer-string))
+      (set (make-local-variable 'Info-dir-file-attributes) dir-file-attrs)))
   (setq default-directory Info-dir-contents-directory))
 
 (defvar Info-streamline-headings
@@ -965,7 +1001,7 @@ a case-insensitive match is tried."
                (if (member-ignore-case x seen)
                    (delete-region (match-beginning 0)
                                   (progn (re-search-forward "^[^ \t]" nil t)
-                                         (goto-char (match-beginning 0))))
+                                         (match-beginning 0)))
                  (push x seen))))))))))
 
 ;; Note that on entry to this function the current-buffer must be the
@@ -1507,9 +1543,9 @@ FOOTNOTENAME may be an abbreviation of the reference name."
            (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)))
+           (set (make-local-variable '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)))))))