aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2006-11-05 12:08:02 +0000
committerEli Zaretskii2006-11-05 12:08:02 +0000
commitec4ef1745798a7299239f68ad4df5ca54a747f6d (patch)
tree4996e528704fffe9e176c26b000cfa32e8f9d579
parentc57038f815a155fd9ac557785bc44933473bdff2 (diff)
downloademacs-ec4ef1745798a7299239f68ad4df5ca54a747f6d.tar.gz
emacs-ec4ef1745798a7299239f68ad4df5ca54a747f6d.zip
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
in custom buffers. (top level) <info-lookup-maybe-add-help>: Add backquote and comma to ignored characters in regexps of help specifications for emacs-lisp-mode and lisp-interaction-mode. This permits looking up symbols in `...' and after a comma. Add help specifications for custom-mode and help-mode.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/info-look.el65
2 files changed, 68 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 41141bd7a8c..0bb302eb566 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12006-11-05 Martin Rudalics <rudalics@gmx.at>
2
3 * info-look.el (info-lookup-guess-custom-symbol): New function
4 for retrieving symbol at point in custom buffers.
5 (top level) <info-lookup-maybe-add-help>: Add backquote and
6 comma to ignored characters in regexps of help specifications
7 for emacs-lisp-mode and lisp-interaction-mode. This permits
8 looking up symbols in `...' and after a comma. Add help
9 specifications for custom-mode and help-mode.
10
12006-11-04 Eli Zaretskii <eliz@gnu.org> 112006-11-04 Eli Zaretskii <eliz@gnu.org>
2 12
3 * mail/rmail.el (rmail-redecode-body): New optional argument RAW. 13 * mail/rmail.el (rmail-redecode-body): New optional argument RAW.
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 2ac461aa669..3918eb00eee 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -250,10 +250,10 @@ system."
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.
253When this command is called interactively, it reads SYMBOL from the minibuffer. 253When this command is called interactively, it reads SYMBOL from the
254In the minibuffer, use M-n to yank the default argument value 254minibuffer. In the minibuffer, use M-n to yank the default argument
255into the minibuffer so you can edit it. 255value into the minibuffer so you can edit it. The default symbol is the
256The default symbol is the one found at point. 256one found at point.
257 257
258With prefix arg a query for the symbol help mode is offered." 258With prefix arg a query for the symbol help mode is offered."
259 (interactive 259 (interactive
@@ -566,6 +566,45 @@ Return nil if there is nothing appropriate in the buffer near point."
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."
@@ -789,7 +828,7 @@ Return nil if there is nothing appropriate in the buffer near point."
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]+\\)?" "'")
@@ -806,13 +845,13 @@ Return nil if there is nothing appropriate in the buffer near point."
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
@@ -913,6 +952,18 @@ Return nil if there is nothing appropriate in the buffer near point."
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