/[emacs]/emacs/lisp/info-look.el
ViewVC logotype

Diff of /emacs/lisp/info-look.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by rms, Fri Jan 25 05:04:37 2002 UTC revision 1.26.4.1 by miles, Fri Apr 4 06:20:08 2003 UTC
# Line 56  Setting this variable to nil disables hi Line 56  Setting this variable to nil disables hi
56    "Overlay object used for highlighting.")    "Overlay object used for highlighting.")
57    
58  (defcustom info-lookup-file-name-alist  (defcustom info-lookup-file-name-alist
59    '(("\\`configure\\.in\\'" . autoconf-mode) ;already covered by auto-mode-alist    '(("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode))
     ("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode))  
60    "Alist of file names handled specially.    "Alist of file names handled specially.
61  List elements are cons cells of the form  List elements are cons cells of the form
62    
# Line 319  If optional argument QUERY is non-nil, q Line 318  If optional argument QUERY is non-nil, q
318    (or mode (setq mode (info-lookup-select-mode)))    (or mode (setq mode (info-lookup-select-mode)))
319    (or (info-lookup->mode-value topic mode)    (or (info-lookup->mode-value topic mode)
320        (error "No %s help available for `%s'" topic mode))        (error "No %s help available for `%s'" topic mode))
321    (let ((entry (or (assoc (if (info-lookup->ignore-case topic mode)    (let* ((completions (info-lookup->completions topic mode))
322                                (downcase item) item)           (ignore-case (info-lookup->ignore-case topic mode))
323                            (info-lookup->completions topic mode))           (entry (or (assoc (if ignore-case (downcase item) item) completions)
324                     (error "Not documented as a %s: %s" topic (or item ""))))                      (assoc-ignore-case item completions)
325          (modes (info-lookup->all-modes topic mode))                      (error "Not documented as a %s: %s" topic (or item ""))))
326          (window (selected-window))           (modes (info-lookup->all-modes topic mode))
327          found doc-spec node prefix suffix doc-found)           (window (selected-window))
328             found doc-spec node prefix suffix doc-found)
329      (if (or (not info-lookup-other-window-flag)      (if (or (not info-lookup-other-window-flag)
330              (eq (current-buffer) (get-buffer "*info*")))              (eq (current-buffer) (get-buffer "*info*")))
331          (info)          (info)
# Line 357  If optional argument QUERY is non-nil, q Line 357  If optional argument QUERY is non-nil, q
357                   nil))                   nil))
358            (condition-case nil            (condition-case nil
359                (progn                (progn
360                  (Info-menu (or (cdr entry) item))                  ;; Don't use Info-menu, it forces case-fold-search to t
361                    (let ((case-fold-search nil))
362                      (re-search-forward
363                       (concat "^\\* " (regexp-quote (or (cdr entry) (car entry)))
364                               ":")))
365                    (Info-follow-nearest-node)
366                  (setq found t)                  (setq found t)
367                  (if (or prefix suffix)                  (if (or prefix suffix)
368                      (let ((case-fold-search                      (let ((case-fold-search
# Line 365  If optional argument QUERY is non-nil, q Line 370  If optional argument QUERY is non-nil, q
370                            (buffer-read-only nil))                            (buffer-read-only nil))
371                        (goto-char (point-min))                        (goto-char (point-min))
372                        (re-search-forward                        (re-search-forward
373                         (concat prefix (regexp-quote item) suffix))                         (concat prefix (regexp-quote (car entry)) suffix))
374                        (goto-char (match-beginning 0))                        (goto-char (match-beginning 0))
375                        (and (display-color-p) info-lookup-highlight-face                        (and (display-color-p) info-lookup-highlight-face
376                             ;; Search again for ITEM so that the first                             ;; Search again for ITEM so that the first
377                             ;; occurrence of ITEM will be highlighted.                             ;; occurrence of ITEM will be highlighted.
378                             (re-search-forward (regexp-quote item))                             (re-search-forward (regexp-quote (car entry)))
379                             (let ((start (match-beginning 0))                             (let ((start (match-beginning 0))
380                                   (end (match-end 0)))                                   (end (match-end 0)))
381                               (if (overlayp info-lookup-highlight-overlay)                               (if (overlayp info-lookup-highlight-overlay)
# Line 383  If optional argument QUERY is non-nil, q Line 388  If optional argument QUERY is non-nil, q
388              (error nil)))              (error nil)))
389          (setq doc-spec (cdr doc-spec)))          (setq doc-spec (cdr doc-spec)))
390        (setq modes (cdr modes)))        (setq modes (cdr modes)))
391        ;; Alert the user if case was munged, and do this after bringing up the
392        ;; info buffer since that can print messages
393        (unless (or ignore-case
394                    (string-equal item (car entry)))
395          (message "Found in different case: %s" (car entry)))
396      (or doc-found      (or doc-found
397          (error "Info documentation for lookup was not found"))          (error "Info documentation for lookup was not found"))
398      ;; Don't leave the Info buffer if the help item couldn't be looked up.      ;; Don't leave the Info buffer if the help item couldn't be looked up.
# Line 672  Return nil if there is nothing appropria Line 682  Return nil if there is nothing appropria
682  (info-lookup-maybe-add-help  (info-lookup-maybe-add-help
683   :mode 'autoconf-mode   :mode 'autoconf-mode
684   :regexp "A[CM]_[_A-Z0-9]+"   :regexp "A[CM]_[_A-Z0-9]+"
685   :doc-spec '(("(autoconf)Macro Index" "AC_"   :doc-spec '(("(autoconf)Autoconf Macro Index" "AC_"
686                  "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
687                 ("(automake)Macro and Variable Index" nil
688                  "^[ \t]*`" "'")
689                 ;; These are for older versions (probably pre autoconf 2.5x):
690                 ("(autoconf)Macro Index" "AC_"
691                "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")                "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>")
692               ("(automake)Macro and Variable Index" nil               ("(automake)Macro and Variable Index" nil
693                "^[ \t]*`" "'"))                "^[ \t]*`" "'"))
# Line 768  Return nil if there is nothing appropria Line 783  Return nil if there is nothing appropria
783  (info-lookup-maybe-add-help  (info-lookup-maybe-add-help
784   :mode 'octave-mode   :mode 'octave-mode
785   :regexp "[_a-zA-Z0-9]+"   :regexp "[_a-zA-Z0-9]+"
786   :doc-spec '(("(octave)Function Index" nil   :doc-spec '(("(octave)Function Index" nil
787                "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)                "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil)
788               ("(octave)Variable Index" nil "^ - [^:]+:[ ]+" nil)               ("(octave)Variable Index" nil "^ - [^:]+:[ ]+" nil)
789               ;; Catch lines of the form "xyz statement"               ;; Catch lines of the form "xyz statement"
# Line 780  Return nil if there is nothing appropria Line 795  Return nil if there is nothing appropria
795                   (t nil)))                   (t nil)))
796                nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here.                nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here.
797                nil)))                nil)))
798    
799    ;; coreutils and bash builtins overlap in places, eg. printf, so there's a
800    ;; question which should come first.  Some of the coreutils descriptions are
801    ;; more detailed, but if bash is usually /bin/sh on a GNU system then the
802    ;; builtins will be what's normally run.
803    ;;
804    ;; Maybe special variables like $? should be matched as $?, not just ?.
805    ;; This would avoid a clash between variable $! and negation !, or variable
806    ;; $# and comment # (though comment # is not currently indexed in bash).
807    ;; Unfortunately if $? etc is the symbol, then we wouldn't be taken to the
808    ;; exact spot in the relevant node, since the bash manual has just `?' etc
809    ;; there.  Maybe an extension to the prefix/suffix scheme could help this.
810    
811    (info-lookup-maybe-add-help
812     :mode 'sh-mode :topic 'symbol
813     ;; bash has "." and ":" in its index, but those chars will probably never
814     ;; work in info, so don't bother matching them in the regexp.
815     :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)"
816     :doc-spec '(("(bash)Builtin Index"       nil "^`" "[ .']")
817                 ("(bash)Reserved Word Index" nil "^`" "[ .']")
818                 ("(bash)Variable Index"      nil "^`" "[ .']")
819                 ;; coreutils (version 4.5.10) doesn't have a separate program
820                 ;; index, so exclude extraneous stuff (most of it) by demanding
821                 ;; "[a-z]+" in the trans-func.
822                 ("(coreutils)Index"
823                  (lambda (item) (if (string-match "\\`[a-z]+\\'" item) item)))
824                 ;; diff (version 2.8.1) has only a few programs, index entries
825                 ;; are things like "foo invocation".
826                 ("(diff)Index"
827                  (lambda (item)
828                    (if (string-match "\\`\\([a-z]+\\) invocation\\'" item)
829                        (match-string 1 item))))
830                 ;; there's no plain "sed" index entry as such, mung another
831                 ;; hopefully unique one to get to the invocation section
832                 ("(sed)Concept Index"
833                  (lambda (item)
834                    (if (string-equal item "Standard input, processing as input")
835                        "sed")))
836                 ;; there's no plain "awk" or "gawk" index entries, mung other
837                 ;; hopefully unique ones to get to the command line options
838                 ("(gawk)Index"
839                  (lambda (item)
840                    (cond ((string-equal item "gawk, extensions, disabling")
841                           "awk")
842                          ((string-equal item "gawk, versions of, information about, printing")
843                           "gawk"))))))
844    
845  (provide 'info-look)  (provide 'info-look)
846    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.26.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26