changeset 40638:84e66cdcffc5

(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.
author Miles Bader <miles@gnu.org>
date Fri, 02 Nov 2001 05:49:48 +0000
parents 9b6f792026b9
children d3a680cb99fd
files lisp/help-mode.el
diffstat 1 files changed, 25 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help-mode.el	Fri Nov 02 04:59:56 2001 +0000
+++ b/lisp/help-mode.el	Fri Nov 02 05:49:48 2001 +0000
@@ -64,48 +64,58 @@
 
 ;; 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 @@
 				     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