diff options
| author | Miles Bader | 2001-11-02 05:49:48 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-11-02 05:49:48 +0000 |
| commit | 6e88156740e011ff60214113fc8d1bab8ccc71d6 (patch) | |
| tree | d2a47ca9d7e8d90c8102c7d55572a3c628108a4d | |
| parent | c22e59e11779f0272f53d7cc43c27fb50981bdfe (diff) | |
| download | emacs-6e88156740e011ff60214113fc8d1bab8ccc71d6.tar.gz emacs-6e88156740e011ff60214113fc8d1bab8ccc71d6.zip | |
(help-xref): New button type.
(help-function, help-variable, help-face, help-coding-system)
(help-input-method, help-character-set, help-type, help-symbol)
(help-back, help-info, help-customize-variable, help-customize-face)
(help-function-def, help-variable-def): Use it as a supertype.
Remove `action' property.
| -rw-r--r-- | lisp/help-mode.el | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index b2b7690101a..4e94af1b8ed 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el | |||
| @@ -64,48 +64,58 @@ The format is (FUNCTION ARGS...).") | |||
| 64 | 64 | ||
| 65 | ;; Button types used by help | 65 | ;; Button types used by help |
| 66 | 66 | ||
| 67 | (define-button-type 'help-xref | ||
| 68 | 'action #'help-button-action) | ||
| 69 | |||
| 70 | (defun help-button-action (button) | ||
| 71 | "Call BUTTON's help function." | ||
| 72 | (help-do-xref (button-start button) | ||
| 73 | (button-get button 'help-function) | ||
| 74 | (button-get button 'help-args))) | ||
| 75 | |||
| 67 | ;; Make some button types that all use the same naming conventions | 76 | ;; Make some button types that all use the same naming conventions |
| 68 | (dolist (help-type '("function" "variable" "face" | 77 | (dolist (help-type '("function" "variable" "face" |
| 69 | "coding-system" "input-method" "character-set")) | 78 | "coding-system" "input-method" "character-set")) |
| 70 | (define-button-type (intern (purecopy (concat "help-" help-type))) | 79 | (define-button-type (intern (purecopy (concat "help-" help-type))) |
| 80 | :supertype 'help-xref | ||
| 71 | 'help-function (intern (concat "describe-" help-type)) | 81 | 'help-function (intern (concat "describe-" help-type)) |
| 72 | 'help-echo (purecopy (concat "mouse-2, RET: describe this " help-type)) | 82 | 'help-echo (purecopy (concat "mouse-2, RET: describe this " help-type)))) |
| 73 | 'action #'help-button-action)) | ||
| 74 | 83 | ||
| 75 | ;; make some more ideosyncratic button types | 84 | ;; make some more ideosyncratic button types |
| 76 | 85 | ||
| 77 | (define-button-type 'help-symbol | 86 | (define-button-type 'help-symbol |
| 87 | :supertype 'help-xref | ||
| 78 | 'help-function #'help-xref-interned | 88 | 'help-function #'help-xref-interned |
| 79 | 'help-echo (purecopy "mouse-2, RET: describe this symbol") | 89 | 'help-echo (purecopy "mouse-2, RET: describe this symbol")) |
| 80 | 'action #'help-button-action) | ||
| 81 | 90 | ||
| 82 | (define-button-type 'help-back | 91 | (define-button-type 'help-back |
| 92 | :supertype 'help-xref | ||
| 83 | 'help-function #'help-xref-go-back | 93 | 'help-function #'help-xref-go-back |
| 84 | 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer") | 94 | 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer")) |
| 85 | 'action #'help-button-action) | ||
| 86 | 95 | ||
| 87 | (define-button-type 'help-info | 96 | (define-button-type 'help-info |
| 97 | :supertype 'help-xref | ||
| 88 | 'help-function #'info | 98 | 'help-function #'info |
| 89 | 'help-echo (purecopy"mouse-2, RET: read this Info node") | 99 | 'help-echo (purecopy"mouse-2, RET: read this Info node")) |
| 90 | 'action #'help-button-action) | ||
| 91 | 100 | ||
| 92 | (define-button-type 'help-customize-variable | 101 | (define-button-type 'help-customize-variable |
| 102 | :supertype 'help-xref | ||
| 93 | 'help-function (lambda (v) | 103 | 'help-function (lambda (v) |
| 94 | (if help-xref-stack | 104 | (if help-xref-stack |
| 95 | (pop help-xref-stack)) | 105 | (pop help-xref-stack)) |
| 96 | (customize-variable v)) | 106 | (customize-variable v)) |
| 97 | 'help-echo (purecopy "mouse-2, RET: customize variable") | 107 | 'help-echo (purecopy "mouse-2, RET: customize variable")) |
| 98 | 'action #'help-button-action) | ||
| 99 | 108 | ||
| 100 | (define-button-type 'help-customize-face | 109 | (define-button-type 'help-customize-face |
| 110 | :supertype 'help-xref | ||
| 101 | 'help-function (lambda (v) | 111 | 'help-function (lambda (v) |
| 102 | (if help-xref-stack | 112 | (if help-xref-stack |
| 103 | (pop help-xref-stack)) | 113 | (pop help-xref-stack)) |
| 104 | (customize-face v)) | 114 | (customize-face v)) |
| 105 | 'help-echo (purecopy "mouse-2, RET: customize face") | 115 | 'help-echo (purecopy "mouse-2, RET: customize face")) |
| 106 | 'action #'help-button-action) | ||
| 107 | 116 | ||
| 108 | (define-button-type 'help-function-def | 117 | (define-button-type 'help-function-def |
| 118 | :supertype 'help-xref | ||
| 109 | 'help-function (lambda (fun file) | 119 | 'help-function (lambda (fun file) |
| 110 | (require 'find-func) | 120 | (require 'find-func) |
| 111 | ;; Don't use find-function-noselect because it follows | 121 | ;; Don't use find-function-noselect because it follows |
| @@ -114,23 +124,16 @@ The format is (FUNCTION ARGS...).") | |||
| 114 | fun nil file))) | 124 | fun nil file))) |
| 115 | (pop-to-buffer (car location)) | 125 | (pop-to-buffer (car location)) |
| 116 | (goto-char (cdr location)))) | 126 | (goto-char (cdr location)))) |
| 117 | 'help-echo (purecopy "mouse-2, RET: find function's definition") | 127 | 'help-echo (purecopy "mouse-2, RET: find function's definition")) |
| 118 | 'action #'help-button-action) | ||
| 119 | 128 | ||
| 120 | (define-button-type 'help-variable-def | 129 | (define-button-type 'help-variable-def |
| 130 | :supertype 'help-xref | ||
| 121 | 'help-function (lambda (var &optional file) | 131 | 'help-function (lambda (var &optional file) |
| 122 | (let ((location | 132 | (let ((location |
| 123 | (find-variable-noselect var file))) | 133 | (find-variable-noselect var file))) |
| 124 | (pop-to-buffer (car location)) | 134 | (pop-to-buffer (car location)) |
| 125 | (goto-char (cdr location)))) | 135 | (goto-char (cdr location)))) |
| 126 | 'help-echo (purecopy"mouse-2, RET: find variable's definition") | 136 | 'help-echo (purecopy"mouse-2, RET: find variable's definition")) |
| 127 | 'action #'help-button-action) | ||
| 128 | |||
| 129 | (defun help-button-action (button) | ||
| 130 | "Call BUTTON's help function." | ||
| 131 | (help-do-xref (button-start button) | ||
| 132 | (button-get button 'help-function) | ||
| 133 | (button-get button 'help-args))) | ||
| 134 | 137 | ||
| 135 | 138 | ||
| 136 | ;;;###autoload | 139 | ;;;###autoload |