diff options
author | Miles Bader <[email protected]> | 2001-11-02 05:49:48 +0000 |
---|---|---|
committer | Miles Bader <[email protected]> | 2001-11-02 05:49:48 +0000 |
commit | 6e88156740e011ff60214113fc8d1bab8ccc71d6 (patch) | |
tree | d2a47ca9d7e8d90c8102c7d55572a3c628108a4d /lisp/help-mode.el | |
parent | c22e59e11779f0272f53d7cc43c27fb50981bdfe (diff) |
(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.
Diffstat (limited to 'lisp/help-mode.el')
-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 b2b7690101..4e94af1b8e 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -64,48 +64,58 @@ The format is (FUNCTION ARGS...).") ;; Button types used by help +(define-button-type 'help-xref + 'action #'help-button-action) + +(defun help-button-action (button) + "Call BUTTON's help function." + (help-do-xref (button-start button) + (button-get button 'help-function) + (button-get button 'help-args))) + ;; Make some button types that all use the same naming conventions (dolist (help-type '("function" "variable" "face" "coding-system" "input-method" "character-set")) (define-button-type (intern (purecopy (concat "help-" help-type))) + :supertype 'help-xref 'help-function (intern (concat "describe-" help-type)) - 'help-echo (purecopy (concat "mouse-2, RET: describe this " help-type)) - 'action #'help-button-action)) + 'help-echo (purecopy (concat "mouse-2, RET: describe this " help-type)))) ;; make some more ideosyncratic button types (define-button-type 'help-symbol + :supertype 'help-xref 'help-function #'help-xref-interned - 'help-echo (purecopy "mouse-2, RET: describe this symbol") - 'action #'help-button-action) + 'help-echo (purecopy "mouse-2, RET: describe this symbol")) (define-button-type 'help-back + :supertype 'help-xref 'help-function #'help-xref-go-back - 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer") - 'action #'help-button-action) + 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer")) (define-button-type 'help-info + :supertype 'help-xref 'help-function #'info - 'help-echo (purecopy"mouse-2, RET: read this Info node") - 'action #'help-button-action) + 'help-echo (purecopy"mouse-2, RET: read this Info node")) (define-button-type 'help-customize-variable + :supertype 'help-xref 'help-function (lambda (v) (if help-xref-stack (pop help-xref-stack)) (customize-variable v)) - 'help-echo (purecopy "mouse-2, RET: customize variable") - 'action #'help-button-action) + 'help-echo (purecopy "mouse-2, RET: customize variable")) (define-button-type 'help-customize-face + :supertype 'help-xref 'help-function (lambda (v) (if help-xref-stack (pop help-xref-stack)) (customize-face v)) - 'help-echo (purecopy "mouse-2, RET: customize face") - 'action #'help-button-action) + 'help-echo (purecopy "mouse-2, RET: customize face")) (define-button-type 'help-function-def + :supertype 'help-xref 'help-function (lambda (fun file) (require 'find-func) ;; Don't use find-function-noselect because it follows @@ -114,23 +124,16 @@ The format is (FUNCTION ARGS...).") fun nil file))) (pop-to-buffer (car location)) (goto-char (cdr location)))) - 'help-echo (purecopy "mouse-2, RET: find function's definition") - 'action #'help-button-action) + 'help-echo (purecopy "mouse-2, RET: find function's definition")) (define-button-type 'help-variable-def + :supertype 'help-xref 'help-function (lambda (var &optional file) (let ((location (find-variable-noselect var file))) (pop-to-buffer (car location)) (goto-char (cdr location)))) - 'help-echo (purecopy"mouse-2, RET: find variable's definition") - 'action #'help-button-action) - -(defun help-button-action (button) - "Call BUTTON's help function." - (help-do-xref (button-start button) - (button-get button 'help-function) - (button-get button 'help-args))) + 'help-echo (purecopy"mouse-2, RET: find variable's definition")) ;;;###autoload |