[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cl-byte-compile-compiler-macro

From: Stefan Monnier
Subject: Re: cl-byte-compile-compiler-macro
Date: Wed, 05 Apr 2006 15:32:18 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> When I compile quux.el, does that need CL to be loaded?
>> (Assume quux.el does not load CL itself.)

>     I think it does, since the accessor function has a byte-compile property
>     that points to function in cl-macs (cl-byte-compile-compiler-macro).

> I think it should be possible to compile quux.el without loading CL.

> I proposed moving that function and its subroutine to subr.el.
> Will that achieve the goal?

An alternative solution might be the following which just ignores the
cl-byte-compile-compiler-macro value unless that function is indeed defined.
Since compiler-macros are supposed to only provide optimizations but no
change in semantics, no running them should always be harmless.
Please install it if you think it's right.


Index: bytecomp.el
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v
retrieving revision 2.181
diff -u -u -b -r2.181 bytecomp.el
--- bytecomp.el 13 Jan 2006 09:54:33 -0000      2.181
+++ bytecomp.el 5 Apr 2006 19:30:00 -0000
@@ -429,8 +429,7 @@
 ;;                            (apply 'byte-compiler-options-handler forms)))
     (eval-when-compile . (lambda (&rest body)
                           (list 'quote
-                                (byte-compile-eval (byte-compile-top-level
-                                                    (cons 'progn body))))))
+                                (byte-compile-eval (cons 'progn body)))))
     (eval-and-compile . (lambda (&rest body)
                          (byte-compile-eval-before-compile (cons 'progn body))
                          (cons 'progn body))))
@@ -2765,6 +2764,11 @@
                (byte-compile-warn "`%s' used from Lisp code\n\
 That command is designed for interactive use only" fn))
           (if (and handler
+                    ;; Make sure that function exists.  This is important
+                    ;; for CL compiler macros since the symbol may be
+                    ;; `cl-byte-compile-compiler-macro' but if CL isn't
+                    ;; loaded, this function doesn't exist.
+                    (fboundp handler)
                    (or (not (byte-compile-version-cond
                        (not (get (get fn 'byte-opcode) 'emacs19-opcode))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]