changeset 104929:41455e351c50

(define-compiler-macro): Add a property that records where a macro was defined.
author Glenn Morris <rgm@gnu.org>
date Fri, 11 Sep 2009 03:39:28 +0000
parents 5532cc06be89
children 61a2a632090d
files lisp/emacs-lisp/cl-macs.el
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl-macs.el	Fri Sep 11 03:39:04 2009 +0000
+++ b/lisp/emacs-lisp/cl-macs.el	Fri Sep 11 03:39:28 2009 +0000
@@ -2547,8 +2547,22 @@
 	 (cons (if (memq '&whole args) (delq '&whole args)
 		 (cons '--cl-whole-arg-- args)) body))
 	(list 'or (list 'get (list 'quote func) '(quote byte-compile))
-	      (list 'put (list 'quote func) '(quote byte-compile)
-		    '(quote cl-byte-compile-compiler-macro)))))
+	      (list 'progn
+		    (list 'put (list 'quote func) '(quote byte-compile)
+			  '(quote cl-byte-compile-compiler-macro))
+		    ;; This is so that describe-function can locate
+		    ;; the macro definition.
+		    (list 'let
+			  (list (list
+				 'file
+				 (or buffer-file-name
+				     (and (boundp 'byte-compile-current-file)
+					  (stringp byte-compile-current-file)
+					  byte-compile-current-file))))
+			  (list 'if 'file
+				(list 'put (list 'quote func)
+				      '(quote compiler-macro-file)
+				      '(file-name-nondirectory file))))))))
 
 ;;;###autoload
 (defun compiler-macroexpand (form)