aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-07-04 10:42:59 -0400
committerStefan Monnier2012-07-04 10:42:59 -0400
commitb5771c0d82b0c1b376e53d8bb92ec4137901db67 (patch)
treeaad22c3380c3eecc906f57a2d48eb802e48b1700
parentee28be33a535e41c74f3a4d5c0f3878e44366942 (diff)
downloademacs-b5771c0d82b0c1b376e53d8bb92ec4137901db67.tar.gz
emacs-b5771c0d82b0c1b376e53d8bb92ec4137901db67.zip
* lisp/emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
function is already compiled.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/emacs-lisp/bytecomp.el40
2 files changed, 28 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 250aaa3bde4..34a74656415 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-07-04 Stefan Monnier <monnier@iro.umontreal.ca> 12012-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
4 function is already compiled.
5
3 * xml.el (xml-name-regexp): Remove, redundant. Use xml-name-re. 6 * xml.el (xml-name-regexp): Remove, redundant. Use xml-name-re.
4 7
52012-07-03 Michael Albinus <michael.albinus@gmx.de> 82012-07-03 Michael Albinus <michael.albinus@gmx.de>
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 71b61ec74cc..76b147a4c65 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2485,22 +2485,32 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2485 (macro (eq (car-safe fun) 'macro))) 2485 (macro (eq (car-safe fun) 'macro)))
2486 (if macro 2486 (if macro
2487 (setq fun (cdr fun))) 2487 (setq fun (cdr fun)))
2488 (when (symbolp form) 2488 (cond
2489 (unless (memq (car-safe fun) '(closure lambda)) 2489 ;; Up until Emacs-24.1, byte-compile silently did nothing when asked to
2490 ;; compile something invalid. So let's tune down the complaint from an
2491 ;; error to a simple message for the known case where signaling an error
2492 ;; causes problems.
2493 ((byte-code-function-p fun)
2494 (message "Function %s is already compiled"
2495 (if (symbolp form) form "provided"))
2496 fun)
2497 (t
2498 (when (symbolp form)
2499 (unless (memq (car-safe fun) '(closure lambda))
2500 (error "Don't know how to compile %S" fun))
2501 (setq fun (byte-compile--reify-function fun))
2502 (setq lexical-binding (eq (car fun) 'closure)))
2503 (unless (eq (car-safe fun) 'lambda)
2490 (error "Don't know how to compile %S" fun)) 2504 (error "Don't know how to compile %S" fun))
2491 (setq fun (byte-compile--reify-function fun)) 2505 ;; Expand macros.
2492 (setq lexical-binding (eq (car fun) 'closure))) 2506 (setq fun (byte-compile-preprocess fun))
2493 (unless (eq (car-safe fun) 'lambda) 2507 ;; Get rid of the `function' quote added by the `lambda' macro.
2494 (error "Don't know how to compile %S" fun)) 2508 (if (eq (car-safe fun) 'function) (setq fun (cadr fun)))
2495 ;; Expand macros. 2509 (setq fun (byte-compile-lambda fun))
2496 (setq fun (byte-compile-preprocess fun)) 2510 (if macro (push 'macro fun))
2497 ;; Get rid of the `function' quote added by the `lambda' macro. 2511 (if (symbolp form)
2498 (if (eq (car-safe fun) 'function) (setq fun (cadr fun))) 2512 (fset form fun)
2499 (setq fun (byte-compile-lambda fun)) 2513 fun)))))))
2500 (if macro (push 'macro fun))
2501 (if (symbolp form)
2502 (fset form fun)
2503 fun)))))
2504 2514
2505(defun byte-compile-sexp (sexp) 2515(defun byte-compile-sexp (sexp)
2506 "Compile and return SEXP." 2516 "Compile and return SEXP."