]> code.delx.au - gnu-emacs/blobdiff - lisp/info-look.el
(insert-for-yank): Set yank-undo-function after calling FUNCTION,
[gnu-emacs] / lisp / info-look.el
index eccf7dcd6c474b75f973c3a195f9e4bbb6124902..1de84d3e4216b7d59367f791e7a8318fc480b574 100644 (file)
@@ -1,9 +1,10 @@
 ;;; info-look.el --- major-mode-sensitive Info index lookup facility
 ;; An older version of this was known as libc.el.
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99,2001  Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org>
+;;         (did not show signs of life (Nov 2001)  -stef)
 ;; Keywords: help languages
 
 ;; This file is part of GNU Emacs.
@@ -55,8 +56,7 @@ Setting this variable to nil disables highlighting."
   "Overlay object used for highlighting.")
 
 (defcustom info-lookup-file-name-alist
-  '(("\\`configure\\.in\\'" . autoconf-mode) ;already covered by auto-mode-alist
-    ("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode))
+  '(("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode))
   "Alist of file names handled specially.
 List elements are cons cells of the form
 
@@ -318,13 +318,14 @@ If optional argument QUERY is non-nil, query for the help mode."
   (or mode (setq mode (info-lookup-select-mode)))
   (or (info-lookup->mode-value topic mode)
       (error "No %s help available for `%s'" topic mode))
-  (let ((entry (or (assoc (if (info-lookup->ignore-case topic mode)
-                             (downcase item) item)
-                         (info-lookup->completions topic mode))
-                  (error "Not documented as a %s: %s" topic (or item ""))))
-       (modes (info-lookup->all-modes topic mode))
-       (window (selected-window))
-       found doc-spec node prefix suffix doc-found)
+  (let* ((completions (info-lookup->completions topic mode))
+         (ignore-case (info-lookup->ignore-case topic mode))
+         (entry (or (assoc (if ignore-case (downcase item) item) completions)
+                    (assoc-ignore-case item completions)
+                    (error "Not documented as a %s: %s" topic (or item ""))))
+         (modes (info-lookup->all-modes topic mode))
+         (window (selected-window))
+         found doc-spec node prefix suffix doc-found)
     (if (or (not info-lookup-other-window-flag)
            (eq (current-buffer) (get-buffer "*info*")))
        (info)
@@ -356,7 +357,12 @@ If optional argument QUERY is non-nil, query for the help mode."
                 nil))
          (condition-case nil
              (progn
-               (Info-menu (or (cdr entry) item))
+                ;; Don't use Info-menu, it forces case-fold-search to t
+                (let ((case-fold-search nil))
+                  (re-search-forward
+                   (concat "^\\* " (regexp-quote (or (cdr entry) (car entry)))
+                           ":")))
+                (Info-follow-nearest-node)
                (setq found t)
                (if (or prefix suffix)
                    (let ((case-fold-search
@@ -364,12 +370,12 @@ If optional argument QUERY is non-nil, query for the help mode."
                          (buffer-read-only nil))
                      (goto-char (point-min))
                      (re-search-forward
-                      (concat prefix (regexp-quote item) suffix))
+                      (concat prefix (regexp-quote (car entry)) suffix))
                      (goto-char (match-beginning 0))
                      (and (display-color-p) info-lookup-highlight-face
                           ;; Search again for ITEM so that the first
-                          ;; occurence of ITEM will be highlighted.
-                          (re-search-forward (regexp-quote item))
+                          ;; occurrence of ITEM will be highlighted.
+                          (re-search-forward (regexp-quote (car entry)))
                           (let ((start (match-beginning 0))
                                 (end (match-end 0)))
                             (if (overlayp info-lookup-highlight-overlay)
@@ -382,6 +388,11 @@ If optional argument QUERY is non-nil, query for the help mode."
            (error nil)))
        (setq doc-spec (cdr doc-spec)))
       (setq modes (cdr modes)))
+    ;; Alert the user if case was munged, and do this after bringing up the
+    ;; info buffer since that can print messages
+    (unless (or ignore-case
+                (string-equal item (car entry)))
+      (message "Found in different case: %s" (car entry)))
     (or doc-found
        (error "Info documentation for lookup was not found"))
     ;; Don't leave the Info buffer if the help item couldn't be looked up.
@@ -646,8 +657,11 @@ Return nil if there is nothing appropriate in the buffer near point."
  :mode 'makefile-mode
  :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
  :doc-spec '(("(make)Name Index" nil
+             "^[ \t]*`" "'")
+            ("(automake)Macro and Variable Index" nil
              "^[ \t]*`" "'"))
- :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
+ :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+"
+ :other-modes '(automake-mode))
 
 (info-lookup-maybe-add-help
  :mode 'texinfo-mode
@@ -668,9 +682,14 @@ Return nil if there is nothing appropriate in the buffer near point."
 (info-lookup-maybe-add-help
  :mode 'autoconf-mode
  :regexp "A[CM]_[_A-Z0-9]+"
- :doc-spec '(("(autoconf)Macro Index" "AC_"
+ :doc-spec '(("(autoconf)Autoconf Macro Index" "AC_"
              "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
-            ("(automake)Index" nil
+            ("(automake)Macro and Variable Index" nil
+             "^[ \t]*`" "'")
+            ;; These are for older versions (probably pre autoconf 2.5x):
+            ("(autoconf)Macro Index" "AC_"
+             "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
+            ("(automake)Macro and Variable Index" nil
              "^[ \t]*`" "'"))
  ;; Autoconf symbols are M4 macros.  Thus use M4's parser.
  :parse-rule 'ignore