1 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
3 * subr.el (apply-partially): Use a non-nil static environment.
4 (--dolist-tail--, --dotimes-limit--): Don't declare dynamically bound.
5 (dolist): Use a more efficient form for lexical-binding.
6 (dotimes): Use a cleaner semantics for lexical-binding.
8 * emacs-lisp/edebug.el (edebug-eval-top-level-form):
9 Use eval-sexp-add-defvars.
11 2011-03-30 Juanma Barranquero <lekktu@gmail.com>
13 * makefile.w32-in (COMPILE_FIRST): Remove pcase.
15 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
17 * subr.el (with-output-to-temp-buffer): Don't change current-buffer to
18 standard-output while running the body.
20 * startup.el: Fix up warnings, move lambda expressions
23 * Makefile.in (COMPILE_FIRST): Remove pcase; it's not so important.
25 2011-03-24 Stefan Monnier <monnier@iro.umontreal.ca>
27 * startup.el: Convert to lexical-binding. Mark unused arguments.
28 (command-line-1): Get rid of the "cl1-" prefix now that we use lexical
30 * emacs-lisp/float-sup.el (pi): Leave it lexically scoped.
31 * emacs-lisp/lisp-mode.el (eval-sexp-add-defvars): New fun.
32 (eval-last-sexp-1): Use eval-sexp-add-defvars.
33 * emacs-lisp/edebug.el (edebug-eval-defun): Use eval-sexp-add-defvars.
34 * emacs-lisp/cconv.el (cconv--analyse-function):
35 Fix `report-error/log-warning' mixup.
37 2011-03-23 Stefan Monnier <monnier@iro.umontreal.ca>
39 * emacs-lisp/bytecomp.el (byte-compile-file-form-defmumble):
40 byte-compile-lambda now always returns a byte-code-function.
41 (byte-compile-byte-code-maker, byte-compile-byte-code-unmake)
42 (byte-compile-closure): Remove.
43 (byte-compile-lambda): Always return a byte-code-function.
44 (byte-compile-top-level): Don't handle `byte-code' forms specially.
45 (byte-compile-inline-lapcode): New function, taken from byte-opt.el.
46 (byte-compile-unfold-bcf): New function.
47 (byte-compile-form): Use it to optimize inline byte-code-functions.
48 (byte-compile-function-form, byte-compile-defun): Simplify.
49 (byte-compile-defmacro): Don't bother calling
50 byte-compile-byte-code-maker.
51 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Move to bytecomp.el.
52 (byte-compile-inline-expand): Inline all bytecompiled functions.
53 Unify the inlining code of the lexbind and dynbind interpreted
55 (byte-compile-unfold-lambda): Don't handle byte-compiled functions
57 (byte-optimize-form-code-walker): Don't optimize byte-compiled inlined
59 (byte-compile-splice-in-already-compiled-code): Remove.
60 (byte-code): Don't optimize it any more.
61 (byte-decompile-bytecode-1): Remove unused bytedecomp-bytes.
62 Leave `byte-return's even for `make-spliceable'.
64 2011-03-20 Christian Ohler <ohler@gnu.org>
66 * emacs-lisp/cl-macs.el (cl-block-wrapper): Fix typo that broke CL
69 2011-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
71 * emacs-lisp/debug.el (debugger-setup-buffer): Revert local change to
72 print depth and length.
74 2011-03-19 Stefan Monnier <monnier@iro.umontreal.ca>
76 * emacs-lisp/cl-macs.el (cl-byte-compile-block, cl-block-wrapper)
77 (cl-block-throw, cl-byte-compile-throw): Use a compiler-macro rather
78 than a `byte-compile' hook to optimize away unused CL blocks, so that
79 also works for lexbind code.
80 Move the code after define-compiler-macro.
82 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
84 * emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
85 Add byte-code-function-p.
86 (pcase--u1): Remove left-over code from early development.
87 Fix case of variable shadowing in guards and predicates.
88 (pcase--u1): Add a new `let' pattern.
90 * emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use
92 (byte-compile-outbuffer): Rename from bytecomp-outbuffer.
93 * emacs-lisp/cl-macs.el (load-time-value):
94 * emacs-lisp/cl.el (cl-compiling-file): Adjust to new name.
96 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Make it work to
97 inline lexbind interpreted functions into lexbind code.
98 (bytedecomp-bytes): Not a dynamic var any more.
99 (disassemble-offset): Get the bytes via an argument instead.
100 (byte-decompile-bytecode-1): Use push.
102 2011-03-15 Stefan Monnier <monnier@iro.umontreal.ca>
104 * makefile.w32-in (COMPILE_FIRST): Fix up last change.
105 * ldefs-boot.el: Revert to upstream's version.
107 2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
109 * help-fns.el (help-function-arglist):
110 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
111 * subr.el (apply-partially): Adjust to new format.
112 * emacs-lisp/disass.el (disassemble-internal): Catch closures.
114 2011-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
116 * subr.el (apply-partially): Move from subr.el; don't use lexical-let.
117 (eval-after-load): Obey lexical-binding.
118 * simple.el (apply-partially): Move to subr.el.
119 * makefile.w32-in: Match changes in Makefile.in.
120 (BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
121 (.el.elc, compile-CMD, compile-SH, compile-always-CMD)
122 (compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
123 (COMPILE_FIRST): Add pcase, macroexp, and cconv.
124 * emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
125 calling CL's `compiler-macroexpand'.
126 * emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
127 (byte-compile-initial-macro-environment)
128 (byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp):
130 (byte-compile-eval, byte-compile-eval-before-compile):
131 Obey lexical-binding.
132 (byte-compile--for-effect): Rename from `for-effect'.
133 (display-call-tree): Use case.
134 * emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
135 (byte-optimize-form-code-walker, byte-optimize-form):
136 Revert to old arg name.
137 * Makefile.in (BYTE_COMPILE_FLAGS): New var.
138 (compile-onefile, .el.elc, compile-calc, recompile): Use it.
140 2011-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
142 * subr.el (letrec): New macro.
143 (with-wrapper-hook): Move from simple.el and don't use CL.
144 * simple.el (with-wrapper-hook): Move with-wrapper-hook to subr.el.
145 * help-fns.el (help-function-arglist): Handle subroutines as well.
146 (describe-variable): Use special-variable-p to filter completions.
147 * emacs-lisp/macroexp.el (macroexpand-all-1): Don't expand `declare'
149 * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
151 * emacs-lisp/cl.el (pushnew): Silence unfixable warning.
152 * emacs-lisp/cl-macs.el (defstruct, define-compiler-macro):
153 Mark unused arg as unused.
154 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Use memq.
155 * emacs-lisp/autoload.el (make-autoload): Don't assume the macro's
156 first sexp is a list.
157 (autoload-generate-file-autoloads): Improve error message.
158 * emacs-lisp/advice.el (ad-arglist): Use help-function-arglist
159 to understand the new byte-code arg format.
165 * textmodes/css-mode.el:
166 * textmodes/bibtex-style.el:
169 * emacs-lisp/smie.el:
170 * abbrev.el: Use lexical-binding.
172 2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
174 * emacs-lisp/bytecomp.el: Use lexical-binding.
175 (byte-recompile-directory): Remove unused var `bytecomp-dest'.
176 (byte-recompile-file): Use derived-mode-p.
177 (byte-compile-from-buffer): Remove arg `bytecomp-filename'.
178 Use byte-compile-current-file instead.
179 (byte-compile-file): Adjust call accordingly.
180 (bytecomp-outbuffer): Move declaration before first use.
181 (for-effect): Declare dynamic.
182 (byte-compile-file-form-defmumble): Use byte-compile-current-file.
183 (byte-compile-top-level, byte-compile-out-toplevel, byte-compile-form):
184 Move dyn-binding of for-effect from function argument to let binding.
185 (byte-compile-out-toplevel): Don't both passing for-effect to
186 byte-optimize-lapcode.
187 (byte-compile-top-level-body, byte-compile-body):
188 Rename for-effect -> for-effect-arg so it's lexical.
190 * subr.el (functionp): Remove, now that it's in src/eval.c.
192 * emacs-lisp/byte-opt.el: Use lexical-binding.
193 (for-effectm byte-compile-tag-number): Declare dynamic.
194 (byte-optimize-form-code-walker, byte-optimize-form): Move dynamic
195 binding of for-effect from function argument to let binding.
196 (byte-decompile-bytecode-1): Move dynamic binding of bytedecomp-bytes
197 from function argument to let binding.
199 * emacs-lisp/cconv.el (cconv--convert-function): Rename from
200 cconv-closure-convert-function.
201 (cconv-convert): Rename from cconv-closure-convert-rec.
202 (cconv--analyse-use): Rename from cconv-analyse-use.
203 (cconv--analyse-function): Rename from cconv-analyse-function.
204 (cconv--analyse-use): Change some patterns to silence compiler.
205 (cconv-convert, cconv--convert-function): Rewrite.
206 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
207 new byte-code representation.
209 2011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
211 * emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
212 Handle integer arglist descriptor.
213 (byte-compile-make-args-desc): Make integer arglist descriptor.
214 (byte-compile-lambda): Use integer arglist descriptor to mark lexical
215 byte-coded functions instead of an extra slot.
216 * help-fns.el (help-add-fundoc-usage): Don't add a dummy doc.
217 (help-split-fundoc): Return a nil doc if there was no actual doc.
218 (help-function-arglist): Generate an arglist from an integer arg-desc.
219 * emacs-lisp/pcase.el (pcase--memoize): Rename from pcase-memoize;
220 Make only the key weak.
221 (pcase): Change the key used in the memoization table, so it does not
222 always get GC'd away.
223 * emacs-lisp/macroexp.el (macroexpand-all-1): Slight change to the
224 pcase pattern to generate slightly better code.
226 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
228 * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
229 (cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
230 (cconv-analyse-use): Improve unused vars warnings.
231 (cconv-analyse-form): Analyze interactive spec in empty lexenv.
232 * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
233 the interactive spec in lexical-binding mode.
234 (byte-compile-refresh-preloaded): Don't reload byte-compiler files.
235 * custom.el (custom-initialize-default): Use defvar.
236 (custom-declare-variable): Set the special-variable-p flag.
237 * help-fns.el (help-make-usage): Drop leading underscores.
238 * dired.el (dired-revert, dired-make-relative): Mark unused args.
239 (dired-unmark-all-files): Remove unused var `query'.
240 (dired-overwrite-confirmed): Declare.
241 (dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
242 * mpc.el: Mark unused args.
243 (mpc--faster-toggle): Remove unused var `songnb'.
244 * server.el (server-kill-buffer-running): Move before first use.
245 * minibuffer.el: Mark unused args.
247 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
249 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
250 λ-lift candidates that end up not λ-lifted.
252 * emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
253 (cconv-mutated, cconv-captured): Remove.
254 (cconv-captured+mutated, cconv-lambda-candidates): Don't give them
256 (cconv-freevars-alist): New var.
257 (cconv-freevars): Remove.
258 (cconv--lookup-let): Remove.
259 (cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
260 (cconv-closure-convert-rec): Adjust to above changes.
261 (fboundp): New function.
262 (cconv-analyse-function, form): Rewrite.
263 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
264 Handle declare-function here.
265 (byte-compile-obsolete): Remove.
266 (byte-compile-arglist-warn): Check late defsubst here.
267 (byte-compile-file-form): Simplify.
268 (byte-compile-file-form-defsubst): Remove.
269 (byte-compile-macroexpand-declare-function): Rename from
270 byte-compile-declare-function, turn it into a macro-expander.
271 (byte-compile-normal-call): Check obsolescence.
272 (byte-compile-quote-form): Remove.
273 (byte-compile-defmacro): Revert to trunk's definition which seems to
274 work just as well and handles `declare'.
275 * emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
276 * Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
277 (compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
278 * emacs-lisp/macroexp.el: Use lexbind.
279 (macroexpand-all-1): Check macro obsolescence.
280 * vc/diff-mode.el: Use lexbind.
281 * follow.el (follow-calc-win-end): Simplify.
283 2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
285 * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
287 (byte-compile-close-variables, displaying-byte-compile-warnings):
289 (byte-compile-toplevel-file-form): New fun, split out of
290 byte-compile-file-form.
291 (byte-compile-from-buffer): Use it to avoid applying cconv
293 (byte-compile): Only strip `function' if it's present.
294 (byte-compile-lambda): Add `reserved-csts' argument.
295 Use new lexenv arg of byte-compile-top-level.
296 (byte-compile-reserved-constants): New var.
297 (byte-compile-constants-vector): Obey it.
298 (byte-compile-constants-vector): Handle new `byte-constant' form.
299 (byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
300 (byte-compile-form): Don't check callargs here.
301 (byte-compile-normal-call): Do it here instead.
302 (byte-compile-push-unknown-constant)
303 (byte-compile-resolve-unknown-constant): Remove, unused.
304 (byte-compile-make-closure): Use `make-byte-code' rather than `curry',
305 putting the environment into the "constant" pool.
306 (byte-compile-get-closed-var): Use special byte-constant.
307 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
308 intermediate special form `internal-make-vector'.
309 (byte-optimize-lapcode): Handle new form of `byte-constant'.
310 * help-fns.el (describe-function-1): Don't handle funvecs.
311 * emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
312 function if the content is a lambda expression, not if it's a closure.
313 * emacs-lisp/eieio-come.el: Remove.
314 * emacs-lisp/eieio.el: Don't require eieio-comp.
315 (defmethod): Do a bit more work to find the body and wrap it into
316 a function before passing it to eieio-defmethod.
317 (eieio-defmethod): New arg `code' for it.
318 * emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
320 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
321 more careful when quoting a function value.
322 * emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
323 (cconv-closure-convert-rec): Catch stray `internal-make-closure'.
324 * Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
326 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
328 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
329 compiler choose the representation of closures.
330 (cconv--env-var): Remove.
331 * emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
332 (byte-compile-make-closure, byte-compile-get-closed-var):
335 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
337 * subr.el (with-output-to-temp-buffer): New macro.
339 * simple.el (count-words-region): Don't use interactive-p.
341 * minibuffer.el: Use lexical-binding. Replace all uses of lexical-let.
343 * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
344 Call byte-compile rather than byte-compile-lambda.
346 * emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
347 Rename from byte-compile-file-form-defmethod.
348 Don't byte-compile-lambda.
349 (eieio-byte-compile-defmethod-param-convert): Rename from
350 byte-compile-defmethod-param-convert.
352 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
353 value of (function (lambda ...)) is self-quoting.
355 * emacs-lisp/cconv.el: Use lexical-binding.
356 (cconv--lookup-let): Rename from cconv-lookup-let.
357 (cconv-closure-convert-rec): Fix handling of captured+mutated
358 arguments in defun/defmacro.
360 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
361 Turn stack-ref-0 into dup.
362 (byte-compile-form): Don't indirect-function since it can signal
364 (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
365 being relative to top rather than to bottom in the byte-code.
366 (with-output-to-temp-buffer): Remove.
367 (byte-compile-with-output-to-temp-buffer): Remove.
369 * emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
370 Remove interactive-p.
371 (byte-optimize-lapcode): Update optimizations now that stack-refs are
372 relative to the top rather than to the bottom.
374 2011-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
376 * subr.el (save-window-excursion): New macro, moved from C.
377 * emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
378 * emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
379 Don't handle save-window-excursion any more.
380 * emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
381 Don't use the byte-code any more.
382 (byte-compile-form): Check macro expansion was done.
383 (byte-compile-save-window-excursion): Remove.
384 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
385 Ignore save-window-excursion. Don't macroepand any more.
387 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
389 * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
390 Avoid destructuring-bind which results in poorer code.
392 2011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
394 * files.el (lexical-binding): Add a safe-local-variable property.
396 * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
397 in lexbind, because it needs a different implementation.
399 * emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
400 (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
401 (cconv--env-var): New constant.
402 (cconv-closure-convert-rec): Use it and use them. Fix a typo that
403 ended up forgetting to remove entries from lmenvs in `let'.
404 For `lambda' use the outer `fvrs' when building the closure and don't
405 forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
407 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
408 Correctly extract arglist from `closure's.
409 (byte-compile-cl-warn): Compiler-macros are run earlier now.
410 (byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
412 (byte-compile-form): Don't run the compiler-macro expander here.
413 (byte-compile-let): Merge with byte-compile-let*.
414 Don't preserve-body-value if the body's value was discarded.
416 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
417 are added to the stack.
418 (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
419 byte-compile-depth now that byte-inline-lapcode does it for us.
420 (byte-compile-inline-expand): Don't inline dynbind byte code into
421 lexbind code, since it has to be done differently.
423 2011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
425 * emacs-lisp/byte-lexbind.el: Delete.
427 * emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
428 (byte-compile-current-num-closures): Remove vars.
429 (byte-vec-ref, byte-vec-set): Remove byte codes.
430 (byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
432 (byte-compile-lambda): Never build a closure.
433 (byte-compile-closure-code-p, byte-compile-make-closure): Remove.
434 (byte-compile-closure): Simplify.
435 (byte-compile-top-level): Don't mess with heap environments.
436 (byte-compile-dynamic-variable-bind): Always maintain
437 byte-compile-bound-variables.
438 (byte-compile-variable-ref, byte-compile-variable-set): Always just use
439 the stack for lexical vars.
440 (byte-compile-push-binding-init): Simplify.
441 (byte-compile-not-lexical-var-p): New function, moved from cconv.el.
442 (byte-compile-bind, byte-compile-unbind): New functions, moved and
443 simplified from byte-lexbind.el.
444 (byte-compile-let, byte-compile-let*): Simplify.
445 (byte-compile-condition-case): Don't add :fun-body to the bound vars.
446 (byte-compile-defmacro): Simplify.
448 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
449 (cconv-freevars, cconv-analyse-function, cconv-analyse-form):
450 Use byte-compile-not-lexical-var-p instead.
452 * help-fns.el (describe-function-1): Fix paren typo.
454 * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
455 (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
457 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
459 * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
460 (cconv-closure-convert-toplevel): Remove.
461 (cconv-lookup-let): New fun.
462 (cconv-closure-convert-rec): Don't bother with defs-are-legal.
463 Use :fun-body to handle special forms that require closing their forms.
465 * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
466 Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
467 (byte-compile-lambda, byte-compile-make-closure):
468 * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
469 Make sure cconv did its job.
471 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
474 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
477 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
479 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
480 renamed to `bytecomp-fun'.
482 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
483 Understand the :fun-body case for catch, save-window-excursion, and
485 (byte-compile-maybe-push-heap-environment): No need when nclosures is
486 zero and byte-compile-current-num-closures is -1.
488 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
489 (cconv-freevars): Use it.
490 (cconv-closure-convert-rec): Avoid `position'.
491 (cconv-analyse-function): New function.
492 (cconv-analyse-form): Use it. `inclosure' can't be nil any more.
493 Check lexical vars at let-binding time rather than when referenced.
494 For defuns to be in an empty environment and lambdas to take lexical args.
495 Pay attention to the need to build closures in catch, unwind-protect,
496 save-window-excursion, condition-case, and track-mouse.
497 Fix defconst/defvar handling.
499 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
501 * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
502 (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
503 (cconv-freevars): Minor cleanup. Fix handling of the error var in
506 * emacs-lisp/bytecomp.el (byte-compile-catch)
507 (byte-compile-unwind-protect, byte-compile-track-mouse)
508 (byte-compile-condition-case, byte-compile-save-window-excursion):
509 Provide a :fun-body alternative, so that info can be propagated from the
510 surrounding context, as is the case for lexical scoping.
512 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
514 * emacs-lisp/cconv.el: New file.
515 * emacs-lisp/bytecomp.el: Use cconv.
516 (byte-compile-file-form, byte-compile):
517 Call cconv-closure-convert-toplevel when requested.
520 * emacs-lisp/pcase.el:
522 * dired.el: Use lexical-binding.
524 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
526 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
528 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
530 * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
531 * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
532 * ielm.el (ielm-eval-input):
533 * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
535 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
537 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
539 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
541 * subr.el (with-lexical-binding): Remove.
543 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
545 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
546 specialp -> special-variable-p.
548 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
550 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
551 Don't macroexpand before evaluating in eval-and-compile, in case
552 `body's macro expansion uses macros and functions defined in itself.
554 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
556 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
557 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
559 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
561 2006-12-04 Miles Bader <miles@gnu.org>
563 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
564 (compile, compile-always): Use it.
566 2005-10-24 Miles Bader <miles@gnu.org>
568 * subr.el (functionp): Re-remove.
570 * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
571 ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
572 (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
573 instead of adding lambda ourselves.
575 2004-08-09 Miles Bader <miles@gnu.org>
577 Changes from merging the funvec patch:
579 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
580 instead of `vector' to create compiled closures.
584 2004-05-20 Miles Bader <miles@gnu.org>
586 * subr.el (functionp): Use `funvecp' instead of
587 `byte-compiled-function-p'.
588 * help-fns.el (describe-function-1): Describe curried functions
589 and other funvecs as such.
590 (help-highlight-arguments): Only format things that look like a
593 2004-04-29 Miles Bader <miles@gnu.org>
595 * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
596 to `byte-compile-lexical-environment' at the start, not end.
597 (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
599 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
600 Don't crash on no-op lapcode entries (car is nil).
602 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
603 Push a lexvar onto lexenv, not a vinfo!
605 2004-04-11 Miles Bader <miles@gnu.org>
607 * emacs-lisp/bytecomp.el (byte-compile-top-level):
608 Correctly analyze lexically-bound arguments.
610 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
611 Use `append' instead of `nconc'.
613 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
614 Don't use backquote to make a mutable data-structure.
615 (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
616 Rename to use `num-' instead of `num'.
617 (byte-compile-make-lambda-lexenv): Adjust accordingly.
619 2004-04-10 Miles Bader <miles@gnu.org>
621 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
622 Look at variable's global specialp state too.
624 2004-04-09 Miles Bader <miles@gnu.org>
626 * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
627 Default initial-stack-depth to 0.
628 (byte-optimize-lapcode): Discard the right number of values in
629 the stack-set+discard-->discard optimization.
631 2004-04-02 Miles Bader <miles@gnu.org>
633 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
634 environment if lexical-binding is enabled.
636 2003-10-14 Miles Bader <miles@gnu.org>
638 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
639 `backquote-list*' to avoid stack overflows.
641 2003-04-04 Miles Bader <miles@gnu.org>
643 * help-fns.el (help-function-arglist): Handle interpreted closures.
645 2002-11-20 Miles Bader <miles@gnu.org>
647 * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
648 Correctly handle discardN* operators.
649 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
652 2002-08-26 Miles Bader <miles@gnu.org>
654 * international/mule.el (make-char): Macroexpand call to
655 charset-id constructed by `byte-compile' hook.
657 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
659 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
660 (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
661 Add more optimizations for lexical binding.
662 (byte-compile-inline-expand): Macroexpand result of inlining.
664 * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
665 byte-compile-closure-initial-lexenv-p.
666 (byte-discardN-preserve-tos): Alias to byte-discardN.
667 (byte-compile-push-binding-init): Don't push unused variables on
669 (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
670 (byte-compile-lambda): Don't look at lexical environment unless
671 we're using lexical binding.
672 (byte-compile-defmacro): Correctly generate macros.
674 * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
675 dynamic-bindings-only case.
676 (byte-compile-bind): Don't special-case unused lexical variables.
678 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
680 2002-08-19 Miles Bader <miles@gnu.org>
682 * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
683 Handle `byte-discardN-preserve-tos' pseudo-op.
684 (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
685 (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
686 (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
687 Add tracking of stack-depth. Unfinished code to collapse
688 lexical-unbinding sequences.
690 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
691 Handle `byte-discardN-preserve-tos' pseudo-op.
692 (byte-compile-top-level): If there are lexical args, output a TAG
693 op to record the initial stack-depth for the optimizer.
695 2002-08-17 Miles Bader <miles@gnu.org>
697 * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
698 (byte-compile-lapcode): Include byte-discardN.
699 (byte-compile-lambda): Fixup closure detection.
700 (byte-compile-top-level): Handle arguments for a lexical lambda.
701 (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
702 (byte-compile-variable-set): Use byte-compile-stack-set/ref.
703 (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
704 (byte-compile-stack-ref, byte-compile-stack-set): New functions.
705 (byte-compile-push-binding-init): Get the variable list properly
708 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
709 Ignore setq'd variables we're not interested in.
710 (byte-compile-make-lambda-lexenv): Add assertion that closed-over
711 variables be heap allocated.
712 (byte-compile-closure-initial-lexenv-p): Rename from
713 byte-compile-closure-lexenv-p.
714 (byte-compile-non-stack-bindings-p): Get the variable list
715 properly from LFORMINFO.
716 (byte-compile-maybe-push-heap-environment): Handle the
717 no-closed-over-variables case correctly.
718 (byte-compile-bind): Use byte-compile-stack-set/ref.
719 Don't bother modifying INIT-LEXENV as no one will see the changes.
720 (byte-compile-unbind): Call `byte-compile-discard' to handle
721 unbinding lexical bindings.
723 * emacs-lisp/disass.el (disassemble-internal): Handle closures.
724 (disassemble-1): Handle new bytecodes.
725 * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
727 2002-06-16 Miles Bader <miles@gnu.org>
729 * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
730 (macroexpand-all-forms, macroexpand-all-clauses): Use it.
731 * Makefile.in (compile): Undo previous change.
733 2002-06-14 Miles Bader <miles@gnu.org>
735 * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
736 (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
737 with an increased max-lisp-eval-depth.
739 * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
740 beginning of the file. Require `byte-lexbind' at compile time.
741 Add a few doc string.
742 (byte-compile-push-bytecodes)
743 (byte-compile-push-bytecode-const2): New macros.
744 (byte-compile-lapcode): Use them. Do general code cleanup.
745 (byte-compile-initial-macro-environment): Expand macros in
746 byte-compile-eval before passing to byte-compile-top-level.
747 (byte-compile): Use the `byte-compile-initial-macro-environment'.
749 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
751 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
753 (byte-compile-maybe-push-heap-environment): Fix function name typo.
755 2002-06-13 Miles Bader <miles@gnu.org>
757 Byte compiler lexical binding support (not finished yet):
758 * emacs-lisp/bytecomp.el: Require `macroexp'.
759 (byte-compile-lexical-environment)
760 (byte-compile-current-heap-environment)
761 (byte-compile-current-num-closures): New variables.
762 (0, 178, 179, 180, 181): New byte-opcodes.
763 (byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
764 error if a delay-output placeholder is not filled in yet.
765 (byte-compile-file-form, byte-compile): Expand all macros with
767 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
769 (byte-compile-make-lambda-lexenv): Autoload.
770 (byte-compile-lambda): Initial code for handling lexically-bound
771 arguments and closures; doesn't work yet.
772 (byte-compile-closure-code-p, byte-compile-make-closure)
773 (byte-compile-closure): New functions.
774 (byte-compile-check-variable, byte-compile-dynamic-variable-op)
775 (byte-compile-dynamic-variable-bind)
776 (byte-compile-lexical-variable-ref, byte-compile-variable-set):
778 (byte-compile-variable-ref): Remove second argument. Now only
779 handles real variable references (not setting or binding).
780 (byte-compile-push-unknown-constant)
781 (byte-compile-resolve-unknown-constant): New functions.
782 (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
783 (byte-compile-function-form): Use either `byte-compile-constant'
784 or `byte-compile-closure'.
785 (byte-compile-setq): Use `byte-compile-variable-set' instead of
786 `byte-compile-variable-ref'.
787 (apply, mapcar, mapatoms, mapconcat, mapc, sort):
788 `byte-defop-compiler-1's removed.
789 (byte-compile-while): Make sure lexically-bound variables inside
790 the loop don't get stored in an environment outside the loop.
791 (byte-compile-compute-lforminfo): Autoload.
792 (byte-compile-push-binding-init): New function.
793 (byte-compile-let, byte-compile-let*): Handle lexical binding.
794 (byte-compile-defun): Use `byte-compile-closure' to do the work.
795 (byte-compile-defmacro): Use `byte-compile-make-closure'.
796 (byte-compile-defvar): Expand the generated call to `push' since
797 we're past macroexpansion already.
798 (byte-compile-stack-adjustment): New function.
799 (byte-compile-out): Make second arg optional. Rewrite for clarity.
800 (byte-compile-delay-out, byte-compile-delayed-out): New functions.
802 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
803 Don't expand macros here.
805 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
807 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
808 (byte-compile-lforminfo-add-var)
809 (byte-compile-lforminfo-note-closure)
810 (byte-compile-compute-lforminfo)
811 (byte-compile-lforminfo-from-lambda)
812 (byte-compile-lforminfo-analyze)
813 (byte-compile-heapenv-add-accessible-env)
814 (byte-compile-heapenv-ensure-access)
815 (byte-compile-rearrange-let-clauses, byte-compile-bind)
816 (byte-compile-unbind): Fix a bunch of typos.
818 2002-06-12 Miles Bader <miles@gnu.org>
820 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
822 * subr.el (functionp): Function removed (now a subr).
823 * help-fns.el (describe-function-1): Handle interpreted closures.
825 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70