]> code.delx.au - gnu-emacs/blobdiff - lisp/info.el
Fix assertion violations in try_window_id (Bug#19511)
[gnu-emacs] / lisp / info.el
index 74bdef5b0504776248e6ba9bac157b85e6521c82..84c0879060f74fdbc44d6a0444502d92e0ee175f 100644 (file)
@@ -1,8 +1,8 @@
 ;; info.el --- info package for Emacs
 
-;; Copyright (C) 1985-1986, 1992-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992-2015 Free Software Foundation, Inc.
 
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: help
 
 ;; This file is part of GNU Emacs.
@@ -732,14 +732,6 @@ in `Info-file-supports-index-cookies-list'."
                             (Info-default-dirs))
                   (split-string path sep))
               (Info-default-dirs))))
-      ;; If we are running uninstalled, our own Info files should
-      ;; always come first.  If INFOPATH was set, they might not.
-      (and path
-          installation-directory
-          (let ((dir (expand-file-name "info/" installation-directory)))
-            (when (file-directory-p dir)
-              (setq Info-directory-list (delete dir Info-directory-list))
-              (push dir Info-directory-list))))
       ;; For a self-contained (ie relocatable) NS build, AFAICS we
       ;; always want the included info directory to be at the head of
       ;; the search path, unless it's already in INFOPATH somewhere.
@@ -780,8 +772,7 @@ with the top-level Info directory.
 In interactive use, a non-numeric prefix argument directs
 this command to read a file name from the minibuffer.
 
-A numeric prefix argument N selects an Info buffer named
-\"*info*<%s>\".
+A numeric prefix argument of N selects an Info buffer named \"*info*<N>\".
 
 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'
@@ -925,7 +916,10 @@ just return nil (no error)."
          (setq filename found)
        (if noerror
            (setq filename nil)
-         (error "Info file %s does not exist" filename)))
+         ;; If there is no previous Info file, go to the directory.
+         (unless Info-current-file
+           (Info-directory))
+         (user-error "Info file %s does not exist" filename)))
       filename))))
 
 (defun Info-find-node (filename nodename &optional no-going-back strict-case)
@@ -1245,12 +1239,14 @@ is non-nil)."
                   (Info-find-index-name Info-point-loc)
                   (setq Info-point-loc nil))))))
     ;; 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)
-        (let ((hist (car Info-history)))
-          (setq Info-history (cdr Info-history))
-          (Info-find-node (nth 0 hist) (nth 1 hist) t)
-          (goto-char (nth 2 hist))))))
+    ;; go back to the previous one or to the Top node.
+    (unless (or Info-current-node no-going-back)
+      (if Info-history
+         (let ((hist (car Info-history)))
+           (setq Info-history (cdr Info-history))
+           (Info-find-node (nth 0 hist) (nth 1 hist) t)
+           (goto-char (nth 2 hist)))
+       (Info-find-node Info-current-file "Top" t)))))
 
 ;; Cache the contents of the (virtual) dir file, once we have merged
 ;; it for the first time, so we can save time subsequently.
@@ -3701,7 +3697,9 @@ Build a menu of the possible matches."
          hits desc)
       (dolist (keyword keywords)
        (push (copy-tree (gethash keyword finder-keywords-hash)) hits))
-      (setq hits (delete-dups (apply 'append hits)))
+      (setq hits (delete-dups (apply 'append hits))
+           ;; Not a meaningful package.
+           hits (delete 'emacs hits))
       (dolist (package hits)
        (setq desc (cdr-safe (assq package package--builtins)))
        (when (vectorp desc)
@@ -3716,6 +3714,9 @@ Build a menu of the possible matches."
     (insert "*****************\n\n")
     (insert
      "Commentary section of the package `" nodename "':\n\n")
+    ;; FIXME this assumes that a file named package.el exists,
+    ;; which is not always true.  E.g. for the nxml package,
+    ;; there is no "nxml.el" (it's nxml-mode.el).
     (let ((str (lm-commentary (find-library-name nodename))))
       (if (null str)
          (insert "Can't find any Commentary section\n\n")
@@ -3965,6 +3966,10 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
     (define-key map "f" 'Info-follow-reference)
     (define-key map "g" 'Info-goto-node)
     (define-key map "h" 'Info-help)
+    ;; This is for compatibility with standalone info (>~ version 5.2).
+    ;; Though for some time, standalone info had H and h reversed.
+    ;; See <http://debbugs.gnu.org/16455>.
+    (define-key map "H" 'describe-mode)
     (define-key map "i" 'Info-index)
     (define-key map "I" 'Info-virtual-index)
     (define-key map "l" 'Info-history-back)
@@ -3988,6 +3993,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
     (define-key map "," 'Info-index-next)
     (define-key map "\177" 'Info-scroll-down)
     (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
+    (define-key map [down-mouse-2] 'ignore) ;Override potential global binding.
     (define-key map [follow-link] 'mouse-face)
     (define-key map [XF86Back] 'Info-history-back)
     (define-key map [XF86Forward] 'Info-history-forward)