emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108862: * lisp/emacs-lisp/bytecomp.e


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108862: * lisp/emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
Date: Wed, 04 Jul 2012 10:42:59 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108862
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-04 10:42:59 -0400
message:
  * lisp/emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
  function is already compiled.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/bytecomp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-04 03:31:34 +0000
+++ b/lisp/ChangeLog    2012-07-04 14:42:59 +0000
@@ -1,5 +1,8 @@
 2012-07-04  Stefan Monnier  <address@hidden>
 
+       * 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  <address@hidden>

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2012-07-02 08:00:05 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2012-07-04 14:42:59 +0000
@@ -2485,22 +2485,32 @@
           (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."


reply via email to

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