comparison lisp/help.el @ 24403:00fd80d4b49f

(help-xref-info-regexp): Allow linebreaks and capital. (help-make-xrefs): Do Info case first.
author Richard M. Stallman <rms@gnu.org>
date Fri, 26 Feb 1999 07:03:34 +0000
parents 85a2d7a71970
children 7c0185b54f2d
comparison
equal deleted inserted replaced
24402:85a2d7a71970 24403:00fd80d4b49f
936 936
937 The words preceding the quoted symbol can be used in doc strings to 937 The words preceding the quoted symbol can be used in doc strings to
938 distinguish references to variables, functions and symbols.") 938 distinguish references to variables, functions and symbols.")
939 939
940 (defvar help-xref-info-regexp 940 (defvar help-xref-info-regexp
941 "\\<info\\s-+node\\s-`\\([^']+\\)'" 941 "\\<[Ii]nfo[ \t\n]+node[ \t\n]+`\\([^']+\\)'"
942 "Regexp matching doc string references to an Info node.") 942 "Regexp matching doc string references to an Info node.")
943 943
944 (defun help-setup-xref (item interactive-p) 944 (defun help-setup-xref (item interactive-p)
945 "Invoked from commands using the \"*Help*\" buffer to install some xref info. 945 "Invoked from commands using the \"*Help*\" buffer to install some xref info.
946 946
978 (inhibit-read-only t)) 978 (inhibit-read-only t))
979 (set-syntax-table emacs-lisp-mode-syntax-table) 979 (set-syntax-table emacs-lisp-mode-syntax-table)
980 ;; The following should probably be abstracted out. 980 ;; The following should probably be abstracted out.
981 (unwind-protect 981 (unwind-protect
982 (progn 982 (progn
983 ;; Info references
984 (save-excursion
985 (while (re-search-forward help-xref-info-regexp nil t)
986 (let ((data (match-string 1)))
987 (save-match-data
988 (unless (string-match "^([^)]+)" data)
989 (setq data (concat "(emacs)" data))))
990 (help-xref-button 1 #'info data))))
983 ;; Quoted symbols 991 ;; Quoted symbols
984 (save-excursion 992 (save-excursion
985 (while (re-search-forward help-xref-symbol-regexp nil t) 993 (while (re-search-forward help-xref-symbol-regexp nil t)
986 (let* ((data (match-string 6)) 994 (let* ((data (match-string 6))
987 (sym (intern-soft data))) 995 (sym (intern-soft data)))
1001 (help-xref-button 6 #'help-xref-interned sym)) 1009 (help-xref-button 6 #'help-xref-interned sym))
1002 ((boundp sym) 1010 ((boundp sym)
1003 (help-xref-button 6 #'describe-variable sym)) 1011 (help-xref-button 6 #'describe-variable sym))
1004 ((fboundp sym) 1012 ((fboundp sym)
1005 (help-xref-button 6 #'describe-function sym))))))) 1013 (help-xref-button 6 #'describe-function sym)))))))
1006 ;; Info references
1007 (save-excursion
1008 (while (re-search-forward help-xref-info-regexp nil t)
1009 (let ((data (match-string 1)))
1010 (save-match-data
1011 (unless (string-match "^([^)]+)" data)
1012 (setq data (concat "(emacs)" data))))
1013 (help-xref-button 1 #'info data))))
1014 ;; An obvious case of a key substitution: 1014 ;; An obvious case of a key substitution:
1015 (save-excursion 1015 (save-excursion
1016 (while (re-search-forward 1016 (while (re-search-forward
1017 ;; Assume command name is only word characters 1017 ;; Assume command name is only word characters
1018 ;; and dashes to get things like `use M-x foo.'. 1018 ;; and dashes to get things like `use M-x foo.'.