]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 4 Jul 2012 14:42:59 +0000 (10:42 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 4 Jul 2012 14:42:59 +0000 (10:42 -0400)
function is already compiled.

lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el

index 250aaa3bde43c1fd76c757adb877773a72645892..34a74656415d726013ea7314a87ec3dccf4ab8ea 100644 (file)
@@ -1,5 +1,8 @@
 2012-07-04  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
+       function is already compiled.
+
        * xml.el (xml-name-regexp): Remove, redundant.  Use xml-name-re.
 
 2012-07-03  Michael Albinus  <michael.albinus@gmx.de>
index 71b61ec74cc7192427db58b3a87ca44fcf885f3e..76b147a4c65a0a2da0777a64b8ba976340881d69 100644 (file)
@@ -2485,22 +2485,32 @@ If FORM is a lambda or a macro, byte-compile it as a function."
           (macro (eq (car-safe fun) 'macro)))
       (if macro
          (setq fun (cdr fun)))
-      (when (symbolp form)
-        (unless (memq (car-safe fun) '(closure lambda))
+      (cond
+       ;; Up until Emacs-24.1, byte-compile silently did nothing when asked to
+       ;; compile something invalid.  So let's tune down the complaint from an
+       ;; error to a simple message for the known case where signaling an error
+       ;; causes problems.
+       ((byte-code-function-p fun)
+        (message "Function %s is already compiled"
+                 (if (symbolp form) form "provided"))
+        fun)
+       (t
+        (when (symbolp form)
+          (unless (memq (car-safe fun) '(closure lambda))
+            (error "Don't know how to compile %S" fun))
+          (setq fun (byte-compile--reify-function fun))
+          (setq lexical-binding (eq (car fun) 'closure)))
+        (unless (eq (car-safe fun) 'lambda)
           (error "Don't know how to compile %S" fun))
-        (setq fun (byte-compile--reify-function fun))
-        (setq lexical-binding (eq (car fun) 'closure)))
-      (unless (eq (car-safe fun) 'lambda)
-        (error "Don't know how to compile %S" fun))
-            ;; Expand macros.
-             (setq fun (byte-compile-preprocess fun))
-            ;; Get rid of the `function' quote added by the `lambda' macro.
-            (if (eq (car-safe fun) 'function) (setq fun (cadr fun)))
-      (setq fun (byte-compile-lambda fun))
-      (if macro (push 'macro fun))
-            (if (symbolp form)
-          (fset form fun)
-        fun)))))
+        ;; Expand macros.
+        (setq fun (byte-compile-preprocess fun))
+        ;; Get rid of the `function' quote added by the `lambda' macro.
+        (if (eq (car-safe fun) 'function) (setq fun (cadr fun)))
+        (setq fun (byte-compile-lambda fun))
+        (if macro (push 'macro fun))
+        (if (symbolp form)
+            (fset form fun)
+          fun)))))))
 
 (defun byte-compile-sexp (sexp)
   "Compile and return SEXP."