diff lisp/help-mode.el @ 104930:61a2a632090d

(help-function-cmacro): New button.
author Glenn Morris <rgm@gnu.org>
date Fri, 11 Sep 2009 03:39:48 +0000
parents a16c6f2e8622
children 009383a57ce8
line wrap: on
line diff
--- a/lisp/help-mode.el	Fri Sep 11 03:39:28 2009 +0000
+++ b/lisp/help-mode.el	Fri Sep 11 03:39:48 2009 +0000
@@ -202,6 +202,22 @@
 		       (message "Unable to find location in file"))))
   'help-echo (purecopy "mouse-2, RET: find function's definition"))
 
+(define-button-type 'help-function-cmacro
+  :supertype 'help-xref
+  'help-function (lambda (fun file)
+		   (setq file (locate-library file t))
+		   (if (and file (file-readable-p file))
+		       (progn
+			 (pop-to-buffer (find-file-noselect file))
+			 (goto-char (point-min))
+			 (if (re-search-forward
+			      (format "^[ \t]*(define-compiler-macro[ \t]+%s"
+				      (regexp-quote (symbol-name fun))) nil t)
+			     (forward-line 0)
+			   (message "Unable to find location in file")))
+		     (message "Unable to find file")))
+  'help-echo (purecopy "mouse-2, RET: find function's compiler macro"))
+
 (define-button-type 'help-variable-def
   :supertype 'help-xref
   'help-function (lambda (var &optional file)