;;; 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.
"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
(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)
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
(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)
(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.
: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
(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