]> git.eshelyaron.com Git - emacs.git/commitdiff
(help-xref): New button type.
authorMiles Bader <miles@gnu.org>
Fri, 2 Nov 2001 05:49:48 +0000 (05:49 +0000)
committerMiles Bader <miles@gnu.org>
Fri, 2 Nov 2001 05:49:48 +0000 (05:49 +0000)
(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.

lisp/help-mode.el

index b2b7690101a198eac2d66c572c4e82976f7fc0c5..4e94af1b8ed3329b93376495495999a7d7fc94de 100644 (file)
@@ -64,48 +64,58 @@ The format is (FUNCTION ARGS...).")
 \f
 ;; 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"))
 
 \f
 ;;;###autoload