comparison lisp/info-look.el @ 90650:02cf29720f31

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 490-504) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 161-163) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-130
author Miles Bader <miles@gnu.org>
date Tue, 07 Nov 2006 23:22:48 +0000
parents 8dd8c8286063 1cf33b77992b
children f1d13e615070
comparison
equal deleted inserted replaced
90649:d53934e7ddef 90650:02cf29720f31
248 248
249 ;;;###autoload (put 'info-lookup-symbol 'info-file "emacs") 249 ;;;###autoload (put 'info-lookup-symbol 'info-file "emacs")
250 ;;;###autoload 250 ;;;###autoload
251 (defun info-lookup-symbol (symbol &optional mode) 251 (defun info-lookup-symbol (symbol &optional mode)
252 "Display the definition of SYMBOL, as found in the relevant manual. 252 "Display the definition of SYMBOL, as found in the relevant manual.
253 When this command is called interactively, it reads SYMBOL from the minibuffer. 253 When this command is called interactively, it reads SYMBOL from the
254 In the minibuffer, use M-n to yank the default argument value 254 minibuffer. In the minibuffer, use M-n to yank the default argument
255 into the minibuffer so you can edit it. 255 value into the minibuffer so you can edit it. The default symbol is the
256 The default symbol is the one found at point. 256 one found at point.
257 257
258 With prefix arg a query for the symbol help mode is offered." 258 With prefix arg a query for the symbol help mode is offered."
259 (interactive 259 (interactive
260 (info-lookup-interactive-arguments 'symbol current-prefix-arg)) 260 (info-lookup-interactive-arguments 'symbol current-prefix-arg))
261 (info-lookup 'symbol symbol mode)) 261 (info-lookup 'symbol symbol mode))
564 name (match-string 1))) 564 name (match-string 1)))
565 (and (or prefix name) 565 (and (or prefix name)
566 (concat prefix name)))) 566 (concat prefix name))))
567 (error nil))) 567 (error nil)))
568 568
569 (defun info-lookup-guess-custom-symbol ()
570 "Get symbol at point in custom buffers."
571 (condition-case nil
572 (save-excursion
573 (let ((case-fold-search t)
574 (ignored-chars "][()`',:.\" \t\n")
575 (significant-chars "^][()`',:.\" \t\n")
576 beg end)
577 (cond
578 ((and (memq (get-char-property (point) 'face)
579 '(custom-variable-tag custom-variable-tag-face))
580 (setq beg (previous-single-char-property-change
581 (point) 'face nil (line-beginning-position)))
582 (setq end (next-single-char-property-change
583 (point) 'face nil (line-end-position)))
584 (> end beg))
585 (subst-char-in-string
586 ?\ ?\- (buffer-substring-no-properties beg end)))
587 ((or (and (looking-at (concat "[" significant-chars "]"))
588 (save-excursion
589 (skip-chars-backward significant-chars)
590 (setq beg (point)))
591 (skip-chars-forward significant-chars)
592 (setq end (point))
593 (> end beg))
594 (and (looking-at "[ \t\n]")
595 (looking-back (concat "[" significant-chars "]"))
596 (setq end (point))
597 (skip-chars-backward significant-chars)
598 (setq beg (point))
599 (> end beg))
600 (and (skip-chars-forward ignored-chars)
601 (setq beg (point))
602 (skip-chars-forward significant-chars)
603 (setq end (point))
604 (> end beg)))
605 (buffer-substring-no-properties beg end)))))
606 (error nil)))
607
569 ;;;###autoload 608 ;;;###autoload
570 (defun info-complete-symbol (&optional mode) 609 (defun info-complete-symbol (&optional mode)
571 "Perform completion on symbol preceding point." 610 "Perform completion on symbol preceding point."
572 (interactive) 611 (interactive)
573 (info-complete 'symbol 612 (info-complete 'symbol
787 :doc-spec '(("(latex)Command Index" nil 826 :doc-spec '(("(latex)Command Index" nil
788 "`" "\\({[^}]*}\\)?'"))) 827 "`" "\\({[^}]*}\\)?'")))
789 828
790 (info-lookup-maybe-add-help 829 (info-lookup-maybe-add-help
791 :mode 'emacs-lisp-mode 830 :mode 'emacs-lisp-mode
792 :regexp "[^][()'\" \t\n]+" 831 :regexp "[^][()`',\" \t\n]+"
793 :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and 832 :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and
794 ;; those without as `M-x foo'. 833 ;; those without as `M-x foo'.
795 ("(emacs)Command Index" nil "`\\(M-x[ \t\n]+\\)?" "'") 834 ("(emacs)Command Index" nil "`\\(M-x[ \t\n]+\\)?" "'")
796 ;; Variables normally appear in nodes as just `foo'. 835 ;; Variables normally appear in nodes as just `foo'.
797 ("(emacs)Variable Index" nil "`" "'") 836 ("(emacs)Variable Index" nil "`" "'")
804 ;; sort of fallback match scheme existed. 843 ;; sort of fallback match scheme existed.
805 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)"))) 844 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)")))
806 845
807 (info-lookup-maybe-add-help 846 (info-lookup-maybe-add-help
808 :mode 'lisp-interaction-mode 847 :mode 'lisp-interaction-mode
809 :regexp "[^][()'\" \t\n]+" 848 :regexp "[^][()`',\" \t\n]+"
810 :parse-rule 'ignore 849 :parse-rule 'ignore
811 :other-modes '(emacs-lisp-mode)) 850 :other-modes '(emacs-lisp-mode))
812 851
813 (info-lookup-maybe-add-help 852 (info-lookup-maybe-add-help
814 :mode 'lisp-mode 853 :mode 'lisp-mode
815 :regexp "[^()'\" \t\n]+" 854 :regexp "[^()`',\" \t\n]+"
816 :parse-rule 'ignore 855 :parse-rule 'ignore
817 :other-modes '(emacs-lisp-mode)) 856 :other-modes '(emacs-lisp-mode))
818 857
819 (info-lookup-maybe-add-help 858 (info-lookup-maybe-add-help
820 :mode 'scheme-mode 859 :mode 'scheme-mode
911 (match-string 1 item) 950 (match-string 1 item)
912 item)) 951 item))
913 ;; This gets functions in evaluated classes. Other 952 ;; This gets functions in evaluated classes. Other
914 ;; possible patterns don't seem to work too well. 953 ;; possible patterns don't seem to work too well.
915 "`" "("))) 954 "`" "(")))
955
956 (info-lookup-maybe-add-help
957 :mode 'custom-mode
958 :ignore-case t
959 :regexp "[^][()`',:\" \t\n]+"
960 :parse-rule 'info-lookup-guess-custom-symbol
961 :other-modes '(emacs-lisp-mode))
962
963 (info-lookup-maybe-add-help
964 :mode 'help-mode
965 :regexp "[^][()`',:\" \t\n]+"
966 :other-modes '(emacs-lisp-mode))
916 967
917 (provide 'info-look) 968 (provide 'info-look)
918 969
919 ;;; arch-tag: 0f1e3ea3-32a2-4461-bbab-3cff93539a74 970 ;;; arch-tag: 0f1e3ea3-32a2-4461-bbab-3cff93539a74
920 ;;; info-look.el ends here 971 ;;; info-look.el ends here