diff options
author | Noam Postavsky <npostavs@gmail.com> | 2016-07-31 20:46:37 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2016-08-06 16:16:02 -0400 |
commit | 031af49e74195ed1645b53dca741fff8a8411a08 (patch) | |
tree | 46598750d92ac766a3180d9891302180276938dd /lisp/emacs-lisp | |
parent | a90d5e6309c0306d931d398506b242c3eb4f40d7 (diff) | |
download | emacs-031af49e74195ed1645b53dca741fff8a8411a08.tar.gz emacs-031af49e74195ed1645b53dca741fff8a8411a08.tar.bz2 emacs-031af49e74195ed1645b53dca741fff8a8411a08.zip |
Fix byte-compile of interactive closures
* lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Put
bindings after docstring and `interactive' form, if any (Bug #24122).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index dc7574e778d..175690af3e8 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2582,7 +2582,13 @@ FUN should be either a `lambda' value or a `closure' value." (pcase-let* (((or (and `(lambda ,args . ,body) (let env nil)) `(closure ,env ,args . ,body)) fun) + (preamble nil) (renv ())) + ;; Split docstring and `interactive' form from body. + (when (stringp (car body)) + (push (pop body) preamble)) + (when (eq (car-safe (car body)) 'interactive) + (push (pop body) preamble)) ;; Turn the function's closed vars (if any) into local let bindings. (dolist (binding env) (cond @@ -2595,8 +2601,8 @@ FUN should be either a `lambda' value or a `closure' value." ((eq binding t)) (t (push `(defvar ,binding) body)))) (if (null renv) - `(lambda ,args ,@body) - `(lambda ,args (let ,(nreverse renv) ,@body))))) + `(lambda ,args ,@preamble ,@body) + `(lambda ,args ,@preamble (let ,(nreverse renv) ,@body))))) ;;;###autoload (defun byte-compile (form) |