diff options
| author | Dave Love | 2000-03-01 19:07:30 +0000 |
|---|---|---|
| committer | Dave Love | 2000-03-01 19:07:30 +0000 |
| commit | d77dae5c405ca87a46c3cb00cba3a2b3f19919eb (patch) | |
| tree | d4e74342778dd833a9f5ee5cfd7e566d3568b264 | |
| parent | 37d5af8a4940f64e2dd09cfaacaf0cfc641bcce9 (diff) | |
| download | emacs-d77dae5c405ca87a46c3cb00cba3a2b3f19919eb.tar.gz emacs-d77dae5c405ca87a46c3cb00cba3a2b3f19919eb.zip | |
(help-xref-button): Add help-echo arg.
(describe-function-1, describe-variable, help-make-xrefs): Use it.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/help.el | 66 |
2 files changed, 58 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 81532335dfc..b562b091841 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2000-03-01 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * help.el (help-xref-button): Add help-echo arg. | ||
| 4 | (describe-function-1, describe-variable, help-make-xrefs): Use it. | ||
| 5 | |||
| 6 | * faces.el (list-faces-display): Supply help-echo with | ||
| 7 | help-make-xrefs. | ||
| 8 | |||
| 9 | * facemenu.el (list-text-properties-at): Set help-xref-stack to | ||
| 10 | nil. | ||
| 11 | |||
| 1 | 2000-03-01 Gerd Moellmann <gerd@gnu.org> | 12 | 2000-03-01 Gerd Moellmann <gerd@gnu.org> |
| 2 | 13 | ||
| 3 | * image.el (defimage): Look for image files in load-path. | 14 | * image.el (defimage): Look for image files in load-path. |
diff --git a/lisp/help.el b/lisp/help.el index 672933d42f7..e88e1571fea 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; help.el --- help commands for Emacs | 1 | ;;; help.el --- help commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: help, internal | 6 | ;; Keywords: help, internal |
| @@ -661,7 +661,8 @@ It can also be nil, if the definition is not associated with any file." | |||
| 661 | (save-excursion | 661 | (save-excursion |
| 662 | (save-match-data | 662 | (save-match-data |
| 663 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) | 663 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) |
| 664 | (help-xref-button 1 #'describe-function def))))) | 664 | (help-xref-button 1 #'describe-function def |
| 665 | "mouse-2, RET: describe this function"))))) | ||
| 665 | (or file-name | 666 | (or file-name |
| 666 | (setq file-name (symbol-file function))) | 667 | (setq file-name (symbol-file function))) |
| 667 | (if file-name | 668 | (if file-name |
| @@ -680,7 +681,8 @@ It can also be nil, if the definition is not associated with any file." | |||
| 680 | (find-function-noselect arg))) | 681 | (find-function-noselect arg))) |
| 681 | (pop-to-buffer (car location)) | 682 | (pop-to-buffer (car location)) |
| 682 | (goto-char (cdr location)))) | 683 | (goto-char (cdr location)))) |
| 683 | function))))) | 684 | function |
| 685 | "mouse-2, RET: find function's definition"))))) | ||
| 684 | (if need-close (princ ")")) | 686 | (if need-close (princ ")")) |
| 685 | (princ ".") | 687 | (princ ".") |
| 686 | (terpri) | 688 | (terpri) |
| @@ -821,7 +823,9 @@ Returns the documentation as a string, also." | |||
| 821 | (re-search-backward | 823 | (re-search-backward |
| 822 | (concat "\\(" customize-label "\\)") nil t) | 824 | (concat "\\(" customize-label "\\)") nil t) |
| 823 | (help-xref-button 1 #'(lambda (v) | 825 | (help-xref-button 1 #'(lambda (v) |
| 824 | (customize-variable v)) variable) | 826 | (customize-variable v)) |
| 827 | variable | ||
| 828 | "mouse-2, RET: customize variable") | ||
| 825 | )))) | 829 | )))) |
| 826 | ;; Make a hyperlink to the library if appropriate. (Don't | 830 | ;; Make a hyperlink to the library if appropriate. (Don't |
| 827 | ;; change the format of the buffer's initial line in case | 831 | ;; change the format of the buffer's initial line in case |
| @@ -834,12 +838,13 @@ Returns the documentation as a string, also." | |||
| 834 | (with-current-buffer "*Help*" | 838 | (with-current-buffer "*Help*" |
| 835 | (save-excursion | 839 | (save-excursion |
| 836 | (re-search-backward "`\\([^`']+\\)'" nil t) | 840 | (re-search-backward "`\\([^`']+\\)'" nil t) |
| 837 | (help-xref-button 1 (lambda (arg) | 841 | (help-xref-button |
| 838 | (let ((location | 842 | 1 (lambda (arg) |
| 839 | (find-variable-noselect arg))) | 843 | (let ((location |
| 840 | (pop-to-buffer (car location)) | 844 | (find-variable-noselect arg))) |
| 841 | (goto-char (cdr location)))) | 845 | (pop-to-buffer (car location)) |
| 842 | variable))))) | 846 | (goto-char (cdr location)))) |
| 847 | variable "mouse-2, RET: find variable's definition"))))) | ||
| 843 | 848 | ||
| 844 | (print-help-return-message) | 849 | (print-help-return-message) |
| 845 | (save-excursion | 850 | (save-excursion |
| @@ -1031,7 +1036,8 @@ that." | |||
| 1031 | (save-match-data | 1036 | (save-match-data |
| 1032 | (unless (string-match "^([^)]+)" data) | 1037 | (unless (string-match "^([^)]+)" data) |
| 1033 | (setq data (concat "(emacs)" data)))) | 1038 | (setq data (concat "(emacs)" data)))) |
| 1034 | (help-xref-button 1 #'info data)))) | 1039 | (help-xref-button 1 #'info data |
| 1040 | "mouse-2, RET: read this Info node")))) | ||
| 1035 | ;; Quoted symbols | 1041 | ;; Quoted symbols |
| 1036 | (save-excursion | 1042 | (save-excursion |
| 1037 | (while (re-search-forward help-xref-symbol-regexp nil t) | 1043 | (while (re-search-forward help-xref-symbol-regexp nil t) |
| @@ -1042,15 +1048,29 @@ that." | |||
| 1042 | ((match-string 3) ; `variable' &c | 1048 | ((match-string 3) ; `variable' &c |
| 1043 | (and (boundp sym) ; `variable' doesn't ensure | 1049 | (and (boundp sym) ; `variable' doesn't ensure |
| 1044 | ; it's actually bound | 1050 | ; it's actually bound |
| 1045 | (help-xref-button 6 #'describe-variable sym))) | 1051 | (help-xref-button |
| 1052 | 6 #'describe-variable sym | ||
| 1053 | "mouse-2, RET: describe this variable"))) | ||
| 1046 | ((match-string 4) ; `function' &c | 1054 | ((match-string 4) ; `function' &c |
| 1047 | (and (fboundp sym) ; similarly | 1055 | (and (fboundp sym) ; similarly |
| 1048 | (help-xref-button 6 #'describe-function sym))) | 1056 | (help-xref-button |
| 1057 | 6 #'describe-function sym | ||
| 1058 | "mouse-2, RET: describe this function"))) | ||
| 1049 | ((match-string 5)) ; nothing for symbol | 1059 | ((match-string 5)) ; nothing for symbol |
| 1050 | ((or (boundp sym) (fboundp sym)) | 1060 | ((and (boundp sym) (fboundp sym)) |
| 1051 | ;; We can't intuit whether to use the | 1061 | ;; We can't intuit whether to use the |
| 1052 | ;; variable or function doc -- supply both. | 1062 | ;; variable or function doc -- supply both. |
| 1053 | (help-xref-button 6 #'help-xref-interned sym))))))) | 1063 | (help-xref-button |
| 1064 | 6 #'help-xref-interned sym | ||
| 1065 | "mouse-2, RET: describe this symbol")) | ||
| 1066 | ((boundp sym) | ||
| 1067 | (help-xref-button | ||
| 1068 | 6 #'describe-variable sym | ||
| 1069 | "mouse-2, RET: describe this variable")) | ||
| 1070 | ((fboundp sym) | ||
| 1071 | (help-xref-button | ||
| 1072 | 6 #'describe-function sym | ||
| 1073 | "mouse-2, RET: describe this function"))))))) | ||
| 1054 | ;; An obvious case of a key substitution: | 1074 | ;; An obvious case of a key substitution: |
| 1055 | (save-excursion | 1075 | (save-excursion |
| 1056 | (while (re-search-forward | 1076 | (while (re-search-forward |
| @@ -1059,7 +1079,9 @@ that." | |||
| 1059 | "\\<M-x\\s-+\\(\\sw\\(\\sw\\|-\\)+\\)" nil t) | 1079 | "\\<M-x\\s-+\\(\\sw\\(\\sw\\|-\\)+\\)" nil t) |
| 1060 | (let ((sym (intern-soft (match-string 1)))) | 1080 | (let ((sym (intern-soft (match-string 1)))) |
| 1061 | (if (fboundp sym) | 1081 | (if (fboundp sym) |
| 1062 | (help-xref-button 1 #'describe-function sym))))) | 1082 | (help-xref-button |
| 1083 | 1 #'describe-function sym | ||
| 1084 | "mouse-2, RET: describe this command"))))) | ||
| 1063 | ;; Look for commands in whole keymap substitutions: | 1085 | ;; Look for commands in whole keymap substitutions: |
| 1064 | (save-excursion | 1086 | (save-excursion |
| 1065 | ;; Make sure to find the first keymap. | 1087 | ;; Make sure to find the first keymap. |
| @@ -1082,7 +1104,8 @@ that." | |||
| 1082 | (let ((sym (intern-soft (match-string 0)))) | 1104 | (let ((sym (intern-soft (match-string 0)))) |
| 1083 | (if (fboundp sym) | 1105 | (if (fboundp sym) |
| 1084 | (help-xref-button | 1106 | (help-xref-button |
| 1085 | 0 #'describe-function sym)))) | 1107 | 0 #'describe-function sym |
| 1108 | "mouse-2, RET: describe this function")))) | ||
| 1086 | (zerop (forward-line))))))))) | 1109 | (zerop (forward-line))))))))) |
| 1087 | (set-syntax-table stab)) | 1110 | (set-syntax-table stab)) |
| 1088 | ;; Make a back-reference in this buffer if appropriate. | 1111 | ;; Make a back-reference in this buffer if appropriate. |
| @@ -1102,13 +1125,14 @@ that." | |||
| 1102 | map)))) | 1125 | map)))) |
| 1103 | (set-buffer-modified-p old-modified)))) | 1126 | (set-buffer-modified-p old-modified)))) |
| 1104 | 1127 | ||
| 1105 | (defun help-xref-button (match-number function data) | 1128 | (defun help-xref-button (match-number function data &optional help-echo) |
| 1106 | "Make a hyperlink for cross-reference text previously matched. | 1129 | "Make a hyperlink for cross-reference text previously matched. |
| 1107 | 1130 | ||
| 1108 | MATCH-NUMBER is the subexpression of interest in the last matched | 1131 | MATCH-NUMBER is the subexpression of interest in the last matched |
| 1109 | regexp. FUNCTION is a function to invoke when the button is | 1132 | regexp. FUNCTION is a function to invoke when the button is |
| 1110 | activated, applied to DATA. DATA may be a single value or a list. | 1133 | activated, applied to DATA. DATA may be a single value or a list. |
| 1111 | See `help-make-xrefs'." | 1134 | See `help-make-xrefs'. |
| 1135 | If optional arg HELP-ECHO is supplied, it is used as a help string." | ||
| 1112 | ;; Don't mung properties we've added specially in some instances. | 1136 | ;; Don't mung properties we've added specially in some instances. |
| 1113 | (unless (get-text-property (match-beginning match-number) 'help-xref) | 1137 | (unless (get-text-property (match-beginning match-number) 'help-xref) |
| 1114 | (add-text-properties (match-beginning match-number) | 1138 | (add-text-properties (match-beginning match-number) |
| @@ -1118,6 +1142,10 @@ See `help-make-xrefs'." | |||
| 1118 | (if (listp data) | 1142 | (if (listp data) |
| 1119 | data | 1143 | data |
| 1120 | (list data))))) | 1144 | (list data))))) |
| 1145 | (if help-echo | ||
| 1146 | (put-text-property (match-beginning match-number) | ||
| 1147 | (match-end match-number) | ||
| 1148 | 'help-echo help-echo)) | ||
| 1121 | (if help-highlight-p | 1149 | (if help-highlight-p |
| 1122 | (put-text-property (match-beginning match-number) | 1150 | (put-text-property (match-beginning match-number) |
| 1123 | (match-end match-number) | 1151 | (match-end match-number) |