Merge from emacs-24; up to 2013-01-03T02:37:57Z!rgm@gnu.org
[bpt/emacs.git] / lisp / emacs-lisp / macroexp.el
index 6bb7964..e8b513f 100644 (file)
@@ -111,15 +111,20 @@ and also to avoid outputting the warning during normal execution."
        (funcall (eval (cadr form)))
        (byte-compile-constant nil)))
 
+(defun macroexp--compiling-p ()
+  "Return non-nil if we're macroexpanding for the compiler."
+  ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this
+  ;; macro-expansion will be processed by the byte-compiler, we check
+  ;; circumstantial evidence.
+  (member '(declare-function . byte-compile-macroexpand-declare-function)
+          macroexpand-all-environment))
+
+
 (defun macroexp--warn-and-return (msg form)
   (let ((when-compiled (lambda () (byte-compile-log-warning msg t))))
     (cond
      ((null msg) form)
-     ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this
-     ;; macro-expansion will be processed by the byte-compiler, we check
-     ;; circumstantial evidence.
-     ((member '(declare-function . byte-compile-macroexpand-declare-function)
-                macroexpand-all-environment)
+     ((macroexp--compiling-p)
       `(progn
          (macroexp--funcall-if-compiled ',when-compiled)
          ,form))