1 2011-03-24 Stefan Monnier <monnier@iro.umontreal.ca>
3 * startup.el: Convert to lexical-binding. Mark unused arguments.
4 (command-line-1): Get rid of the "cl1-" prefix now that we use lexical
6 * emacs-lisp/float-sup.el (pi): Leave it lexically scoped.
7 * emacs-lisp/lisp-mode.el (eval-sexp-add-defvars): New fun.
8 (eval-last-sexp-1): Use eval-sexp-add-defvars.
9 * emacs-lisp/edebug.el (edebug-eval-defun): Use eval-sexp-add-defvars.
10 * emacs-lisp/cconv.el (cconv--analyse-function):
11 Fix `report-error/log-warning' mixup.
13 2011-03-23 Stefan Monnier <monnier@iro.umontreal.ca>
15 * emacs-lisp/bytecomp.el (byte-compile-file-form-defmumble):
16 byte-compile-lambda now always returns a byte-code-function.
17 (byte-compile-byte-code-maker, byte-compile-byte-code-unmake)
18 (byte-compile-closure): Remove.
19 (byte-compile-lambda): Always return a byte-code-function.
20 (byte-compile-top-level): Don't handle `byte-code' forms specially.
21 (byte-compile-inline-lapcode): New function, taken from byte-opt.el.
22 (byte-compile-unfold-bcf): New function.
23 (byte-compile-form): Use it to optimize inline byte-code-functions.
24 (byte-compile-function-form, byte-compile-defun): Simplify.
25 (byte-compile-defmacro): Don't bother calling
26 byte-compile-byte-code-maker.
27 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Move to bytecomp.el.
28 (byte-compile-inline-expand): Inline all bytecompiled functions.
29 Unify the inlining code of the lexbind and dynbind interpreted
31 (byte-compile-unfold-lambda): Don't handle byte-compiled functions
33 (byte-optimize-form-code-walker): Don't optimize byte-compiled inlined
35 (byte-compile-splice-in-already-compiled-code): Remove.
36 (byte-code): Don't optimize it any more.
37 (byte-decompile-bytecode-1): Remove unused bytedecomp-bytes.
38 Leave `byte-return's even for `make-spliceable'.
40 2011-03-20 Christian Ohler <ohler@gnu.org>
42 * emacs-lisp/cl-macs.el (cl-block-wrapper): Fix typo that broke CL
45 2011-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
47 * emacs-lisp/debug.el (debugger-setup-buffer): Revert local change to
48 print depth and length.
50 2011-03-19 Stefan Monnier <monnier@iro.umontreal.ca>
52 * emacs-lisp/cl-macs.el (cl-byte-compile-block, cl-block-wrapper)
53 (cl-block-throw, cl-byte-compile-throw): Use a compiler-macro rather
54 than a `byte-compile' hook to optimize away unused CL blocks, so that
55 also works for lexbind code.
56 Move the code after define-compiler-macro.
58 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
60 * emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
61 Add byte-code-function-p.
62 (pcase--u1): Remove left-over code from early development.
63 Fix case of variable shadowing in guards and predicates.
64 (pcase--u1): Add a new `let' pattern.
66 * emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use
68 (byte-compile-outbuffer): Rename from bytecomp-outbuffer.
69 * emacs-lisp/cl-macs.el (load-time-value):
70 * emacs-lisp/cl.el (cl-compiling-file): Adjust to new name.
72 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Make it work to
73 inline lexbind interpreted functions into lexbind code.
74 (bytedecomp-bytes): Not a dynamic var any more.
75 (disassemble-offset): Get the bytes via an argument instead.
76 (byte-decompile-bytecode-1): Use push.
78 2011-03-15 Stefan Monnier <monnier@iro.umontreal.ca>
80 * makefile.w32-in (COMPILE_FIRST): Fix up last change.
81 * ldefs-boot.el: Revert to upstream's version.
83 2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
85 * help-fns.el (help-function-arglist):
86 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
87 * subr.el (apply-partially): Adjust to new format.
88 * emacs-lisp/disass.el (disassemble-internal): Catch closures.
90 2011-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
92 * subr.el (apply-partially): Move from subr.el; don't use lexical-let.
93 (eval-after-load): Obey lexical-binding.
94 * simple.el (apply-partially): Move to subr.el.
95 * makefile.w32-in: Match changes in Makefile.in.
96 (BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
97 (.el.elc, compile-CMD, compile-SH, compile-always-CMD)
98 (compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
99 (COMPILE_FIRST): Add pcase, macroexp, and cconv.
100 * emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
101 calling CL's `compiler-macroexpand'.
102 * emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
103 (byte-compile-initial-macro-environment)
104 (byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp):
106 (byte-compile-eval, byte-compile-eval-before-compile):
107 Obey lexical-binding.
108 (byte-compile--for-effect): Rename from `for-effect'.
109 (display-call-tree): Use case.
110 * emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
111 (byte-optimize-form-code-walker, byte-optimize-form):
112 Revert to old arg name.
113 * Makefile.in (BYTE_COMPILE_FLAGS): New var.
114 (compile-onefile, .el.elc, compile-calc, recompile): Use it.
116 2011-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
118 * subr.el (letrec): New macro.
119 (with-wrapper-hook): Move from simple.el and don't use CL.
120 * simple.el (with-wrapper-hook): Move with-wrapper-hook to subr.el.
121 * help-fns.el (help-function-arglist): Handle subroutines as well.
122 (describe-variable): Use special-variable-p to filter completions.
123 * emacs-lisp/macroexp.el (macroexpand-all-1): Don't expand `declare'
125 * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
127 * emacs-lisp/cl.el (pushnew): Silence unfixable warning.
128 * emacs-lisp/cl-macs.el (defstruct, define-compiler-macro):
129 Mark unused arg as unused.
130 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Use memq.
131 * emacs-lisp/autoload.el (make-autoload): Don't assume the macro's
132 first sexp is a list.
133 (autoload-generate-file-autoloads): Improve error message.
134 * emacs-lisp/advice.el (ad-arglist): Use help-function-arglist
135 to understand the new byte-code arg format.
141 * textmodes/css-mode.el:
142 * textmodes/bibtex-style.el:
145 * emacs-lisp/smie.el:
146 * abbrev.el: Use lexical-binding.
148 2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
150 * emacs-lisp/bytecomp.el: Use lexical-binding.
151 (byte-recompile-directory): Remove unused var `bytecomp-dest'.
152 (byte-recompile-file): Use derived-mode-p.
153 (byte-compile-from-buffer): Remove arg `bytecomp-filename'.
154 Use byte-compile-current-file instead.
155 (byte-compile-file): Adjust call accordingly.
156 (bytecomp-outbuffer): Move declaration before first use.
157 (for-effect): Declare dynamic.
158 (byte-compile-file-form-defmumble): Use byte-compile-current-file.
159 (byte-compile-top-level, byte-compile-out-toplevel, byte-compile-form):
160 Move dyn-binding of for-effect from function argument to let binding.
161 (byte-compile-out-toplevel): Don't both passing for-effect to
162 byte-optimize-lapcode.
163 (byte-compile-top-level-body, byte-compile-body):
164 Rename for-effect -> for-effect-arg so it's lexical.
166 * subr.el (functionp): Remove, now that it's in src/eval.c.
168 * emacs-lisp/byte-opt.el: Use lexical-binding.
169 (for-effectm byte-compile-tag-number): Declare dynamic.
170 (byte-optimize-form-code-walker, byte-optimize-form): Move dynamic
171 binding of for-effect from function argument to let binding.
172 (byte-decompile-bytecode-1): Move dynamic binding of bytedecomp-bytes
173 from function argument to let binding.
175 * emacs-lisp/cconv.el (cconv--convert-function): Rename from
176 cconv-closure-convert-function.
177 (cconv-convert): Rename from cconv-closure-convert-rec.
178 (cconv--analyse-use): Rename from cconv-analyse-use.
179 (cconv--analyse-function): Rename from cconv-analyse-function.
180 (cconv--analyse-use): Change some patterns to silence compiler.
181 (cconv-convert, cconv--convert-function): Rewrite.
182 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
183 new byte-code representation.
185 2011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
187 * emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
188 Handle integer arglist descriptor.
189 (byte-compile-make-args-desc): Make integer arglist descriptor.
190 (byte-compile-lambda): Use integer arglist descriptor to mark lexical
191 byte-coded functions instead of an extra slot.
192 * help-fns.el (help-add-fundoc-usage): Don't add a dummy doc.
193 (help-split-fundoc): Return a nil doc if there was no actual doc.
194 (help-function-arglist): Generate an arglist from an integer arg-desc.
195 * emacs-lisp/pcase.el (pcase--memoize): Rename from pcase-memoize;
196 Make only the key weak.
197 (pcase): Change the key used in the memoization table, so it does not
198 always get GC'd away.
199 * emacs-lisp/macroexp.el (macroexpand-all-1): Slight change to the
200 pcase pattern to generate slightly better code.
202 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
204 * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
205 (cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
206 (cconv-analyse-use): Improve unused vars warnings.
207 (cconv-analyse-form): Analyze interactive spec in empty lexenv.
208 * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
209 the interactive spec in lexical-binding mode.
210 (byte-compile-refresh-preloaded): Don't reload byte-compiler files.
211 * custom.el (custom-initialize-default): Use defvar.
212 (custom-declare-variable): Set the special-variable-p flag.
213 * help-fns.el (help-make-usage): Drop leading underscores.
214 * dired.el (dired-revert, dired-make-relative): Mark unused args.
215 (dired-unmark-all-files): Remove unused var `query'.
216 (dired-overwrite-confirmed): Declare.
217 (dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
218 * mpc.el: Mark unused args.
219 (mpc--faster-toggle): Remove unused var `songnb'.
220 * server.el (server-kill-buffer-running): Move before first use.
221 * minibuffer.el: Mark unused args.
223 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
225 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
226 λ-lift candidates that end up not λ-lifted.
228 * emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
229 (cconv-mutated, cconv-captured): Remove.
230 (cconv-captured+mutated, cconv-lambda-candidates): Don't give them
232 (cconv-freevars-alist): New var.
233 (cconv-freevars): Remove.
234 (cconv--lookup-let): Remove.
235 (cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
236 (cconv-closure-convert-rec): Adjust to above changes.
237 (fboundp): New function.
238 (cconv-analyse-function, form): Rewrite.
239 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
240 Handle declare-function here.
241 (byte-compile-obsolete): Remove.
242 (byte-compile-arglist-warn): Check late defsubst here.
243 (byte-compile-file-form): Simplify.
244 (byte-compile-file-form-defsubst): Remove.
245 (byte-compile-macroexpand-declare-function): Rename from
246 byte-compile-declare-function, turn it into a macro-expander.
247 (byte-compile-normal-call): Check obsolescence.
248 (byte-compile-quote-form): Remove.
249 (byte-compile-defmacro): Revert to trunk's definition which seems to
250 work just as well and handles `declare'.
251 * emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
252 * Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
253 (compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
254 * emacs-lisp/macroexp.el: Use lexbind.
255 (macroexpand-all-1): Check macro obsolescence.
256 * vc/diff-mode.el: Use lexbind.
257 * follow.el (follow-calc-win-end): Simplify.
259 2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
261 * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
263 (byte-compile-close-variables, displaying-byte-compile-warnings):
265 (byte-compile-toplevel-file-form): New fun, split out of
266 byte-compile-file-form.
267 (byte-compile-from-buffer): Use it to avoid applying cconv
269 (byte-compile): Only strip `function' if it's present.
270 (byte-compile-lambda): Add `reserved-csts' argument.
271 Use new lexenv arg of byte-compile-top-level.
272 (byte-compile-reserved-constants): New var.
273 (byte-compile-constants-vector): Obey it.
274 (byte-compile-constants-vector): Handle new `byte-constant' form.
275 (byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
276 (byte-compile-form): Don't check callargs here.
277 (byte-compile-normal-call): Do it here instead.
278 (byte-compile-push-unknown-constant)
279 (byte-compile-resolve-unknown-constant): Remove, unused.
280 (byte-compile-make-closure): Use `make-byte-code' rather than `curry',
281 putting the environment into the "constant" pool.
282 (byte-compile-get-closed-var): Use special byte-constant.
283 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
284 intermediate special form `internal-make-vector'.
285 (byte-optimize-lapcode): Handle new form of `byte-constant'.
286 * help-fns.el (describe-function-1): Don't handle funvecs.
287 * emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
288 function if the content is a lambda expression, not if it's a closure.
289 * emacs-lisp/eieio-come.el: Remove.
290 * emacs-lisp/eieio.el: Don't require eieio-comp.
291 (defmethod): Do a bit more work to find the body and wrap it into
292 a function before passing it to eieio-defmethod.
293 (eieio-defmethod): New arg `code' for it.
294 * emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
296 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
297 more careful when quoting a function value.
298 * emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
299 (cconv-closure-convert-rec): Catch stray `internal-make-closure'.
300 * Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
302 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
304 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
305 compiler choose the representation of closures.
306 (cconv--env-var): Remove.
307 * emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
308 (byte-compile-make-closure, byte-compile-get-closed-var):
311 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
313 * subr.el (with-output-to-temp-buffer): New macro.
315 * simple.el (count-words-region): Don't use interactive-p.
317 * minibuffer.el: Use lexical-binding. Replace all uses of lexical-let.
319 * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
320 Call byte-compile rather than byte-compile-lambda.
322 * emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
323 Rename from byte-compile-file-form-defmethod.
324 Don't byte-compile-lambda.
325 (eieio-byte-compile-defmethod-param-convert): Rename from
326 byte-compile-defmethod-param-convert.
328 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
329 value of (function (lambda ...)) is self-quoting.
331 * emacs-lisp/cconv.el: Use lexical-binding.
332 (cconv--lookup-let): Rename from cconv-lookup-let.
333 (cconv-closure-convert-rec): Fix handling of captured+mutated
334 arguments in defun/defmacro.
336 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
337 Turn stack-ref-0 into dup.
338 (byte-compile-form): Don't indirect-function since it can signal
340 (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
341 being relative to top rather than to bottom in the byte-code.
342 (with-output-to-temp-buffer): Remove.
343 (byte-compile-with-output-to-temp-buffer): Remove.
345 * emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
346 Remove interactive-p.
347 (byte-optimize-lapcode): Update optimizations now that stack-refs are
348 relative to the top rather than to the bottom.
350 2011-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
352 * subr.el (save-window-excursion): New macro, moved from C.
353 * emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
354 * emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
355 Don't handle save-window-excursion any more.
356 * emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
357 Don't use the byte-code any more.
358 (byte-compile-form): Check macro expansion was done.
359 (byte-compile-save-window-excursion): Remove.
360 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
361 Ignore save-window-excursion. Don't macroepand any more.
363 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
365 * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
366 Avoid destructuring-bind which results in poorer code.
368 2011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
370 * files.el (lexical-binding): Add a safe-local-variable property.
372 * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
373 in lexbind, because it needs a different implementation.
375 * emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
376 (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
377 (cconv--env-var): New constant.
378 (cconv-closure-convert-rec): Use it and use them. Fix a typo that
379 ended up forgetting to remove entries from lmenvs in `let'.
380 For `lambda' use the outer `fvrs' when building the closure and don't
381 forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
383 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
384 Correctly extract arglist from `closure's.
385 (byte-compile-cl-warn): Compiler-macros are run earlier now.
386 (byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
388 (byte-compile-form): Don't run the compiler-macro expander here.
389 (byte-compile-let): Merge with byte-compile-let*.
390 Don't preserve-body-value if the body's value was discarded.
392 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
393 are added to the stack.
394 (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
395 byte-compile-depth now that byte-inline-lapcode does it for us.
396 (byte-compile-inline-expand): Don't inline dynbind byte code into
397 lexbind code, since it has to be done differently.
399 2011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
401 * emacs-lisp/byte-lexbind.el: Delete.
403 * emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
404 (byte-compile-current-num-closures): Remove vars.
405 (byte-vec-ref, byte-vec-set): Remove byte codes.
406 (byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
408 (byte-compile-lambda): Never build a closure.
409 (byte-compile-closure-code-p, byte-compile-make-closure): Remove.
410 (byte-compile-closure): Simplify.
411 (byte-compile-top-level): Don't mess with heap environments.
412 (byte-compile-dynamic-variable-bind): Always maintain
413 byte-compile-bound-variables.
414 (byte-compile-variable-ref, byte-compile-variable-set): Always just use
415 the stack for lexical vars.
416 (byte-compile-push-binding-init): Simplify.
417 (byte-compile-not-lexical-var-p): New function, moved from cconv.el.
418 (byte-compile-bind, byte-compile-unbind): New functions, moved and
419 simplified from byte-lexbind.el.
420 (byte-compile-let, byte-compile-let*): Simplify.
421 (byte-compile-condition-case): Don't add :fun-body to the bound vars.
422 (byte-compile-defmacro): Simplify.
424 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
425 (cconv-freevars, cconv-analyse-function, cconv-analyse-form):
426 Use byte-compile-not-lexical-var-p instead.
428 * help-fns.el (describe-function-1): Fix paren typo.
430 * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
431 (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
433 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
435 * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
436 (cconv-closure-convert-toplevel): Remove.
437 (cconv-lookup-let): New fun.
438 (cconv-closure-convert-rec): Don't bother with defs-are-legal.
439 Use :fun-body to handle special forms that require closing their forms.
441 * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
442 Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
443 (byte-compile-lambda, byte-compile-make-closure):
444 * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
445 Make sure cconv did its job.
447 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
450 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
453 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
455 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
456 renamed to `bytecomp-fun'.
458 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
459 Understand the :fun-body case for catch, save-window-excursion, and
461 (byte-compile-maybe-push-heap-environment): No need when nclosures is
462 zero and byte-compile-current-num-closures is -1.
464 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
465 (cconv-freevars): Use it.
466 (cconv-closure-convert-rec): Avoid `position'.
467 (cconv-analyse-function): New function.
468 (cconv-analyse-form): Use it. `inclosure' can't be nil any more.
469 Check lexical vars at let-binding time rather than when referenced.
470 For defuns to be in an empty environment and lambdas to take lexical args.
471 Pay attention to the need to build closures in catch, unwind-protect,
472 save-window-excursion, condition-case, and track-mouse.
473 Fix defconst/defvar handling.
475 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
477 * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
478 (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
479 (cconv-freevars): Minor cleanup. Fix handling of the error var in
482 * emacs-lisp/bytecomp.el (byte-compile-catch)
483 (byte-compile-unwind-protect, byte-compile-track-mouse)
484 (byte-compile-condition-case, byte-compile-save-window-excursion):
485 Provide a :fun-body alternative, so that info can be propagated from the
486 surrounding context, as is the case for lexical scoping.
488 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
490 * emacs-lisp/cconv.el: New file.
491 * emacs-lisp/bytecomp.el: Use cconv.
492 (byte-compile-file-form, byte-compile):
493 Call cconv-closure-convert-toplevel when requested.
496 * emacs-lisp/pcase.el:
498 * dired.el: Use lexical-binding.
500 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
502 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
504 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
506 * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
507 * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
508 * ielm.el (ielm-eval-input):
509 * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
511 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
513 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
515 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
517 * subr.el (with-lexical-binding): Remove.
519 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
521 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
522 specialp -> special-variable-p.
524 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
526 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
527 Don't macroexpand before evaluating in eval-and-compile, in case
528 `body's macro expansion uses macros and functions defined in itself.
530 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
532 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
533 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
535 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
537 2006-12-04 Miles Bader <miles@gnu.org>
539 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
540 (compile, compile-always): Use it.
542 2005-10-24 Miles Bader <miles@gnu.org>
544 * subr.el (functionp): Re-remove.
546 * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
547 ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
548 (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
549 instead of adding lambda ourselves.
551 2004-08-09 Miles Bader <miles@gnu.org>
553 Changes from merging the funvec patch:
555 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
556 instead of `vector' to create compiled closures.
560 2004-05-20 Miles Bader <miles@gnu.org>
562 * subr.el (functionp): Use `funvecp' instead of
563 `byte-compiled-function-p'.
564 * help-fns.el (describe-function-1): Describe curried functions
565 and other funvecs as such.
566 (help-highlight-arguments): Only format things that look like a
569 2004-04-29 Miles Bader <miles@gnu.org>
571 * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
572 to `byte-compile-lexical-environment' at the start, not end.
573 (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
575 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
576 Don't crash on no-op lapcode entries (car is nil).
578 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
579 Push a lexvar onto lexenv, not a vinfo!
581 2004-04-11 Miles Bader <miles@gnu.org>
583 * emacs-lisp/bytecomp.el (byte-compile-top-level):
584 Correctly analyze lexically-bound arguments.
586 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
587 Use `append' instead of `nconc'.
589 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
590 Don't use backquote to make a mutable data-structure.
591 (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
592 Rename to use `num-' instead of `num'.
593 (byte-compile-make-lambda-lexenv): Adjust accordingly.
595 2004-04-10 Miles Bader <miles@gnu.org>
597 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
598 Look at variable's global specialp state too.
600 2004-04-09 Miles Bader <miles@gnu.org>
602 * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
603 Default initial-stack-depth to 0.
604 (byte-optimize-lapcode): Discard the right number of values in
605 the stack-set+discard-->discard optimization.
607 2004-04-02 Miles Bader <miles@gnu.org>
609 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
610 environment if lexical-binding is enabled.
612 2003-10-14 Miles Bader <miles@gnu.org>
614 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
615 `backquote-list*' to avoid stack overflows.
617 2003-04-04 Miles Bader <miles@gnu.org>
619 * help-fns.el (help-function-arglist): Handle interpreted closures.
621 2002-11-20 Miles Bader <miles@gnu.org>
623 * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
624 Correctly handle discardN* operators.
625 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
628 2002-08-26 Miles Bader <miles@gnu.org>
630 * international/mule.el (make-char): Macroexpand call to
631 charset-id constructed by `byte-compile' hook.
633 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
635 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
636 (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
637 Add more optimizations for lexical binding.
638 (byte-compile-inline-expand): Macroexpand result of inlining.
640 * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
641 byte-compile-closure-initial-lexenv-p.
642 (byte-discardN-preserve-tos): Alias to byte-discardN.
643 (byte-compile-push-binding-init): Don't push unused variables on
645 (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
646 (byte-compile-lambda): Don't look at lexical environment unless
647 we're using lexical binding.
648 (byte-compile-defmacro): Correctly generate macros.
650 * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
651 dynamic-bindings-only case.
652 (byte-compile-bind): Don't special-case unused lexical variables.
654 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
656 2002-08-19 Miles Bader <miles@gnu.org>
658 * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
659 Handle `byte-discardN-preserve-tos' pseudo-op.
660 (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
661 (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
662 (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
663 Add tracking of stack-depth. Unfinished code to collapse
664 lexical-unbinding sequences.
666 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
667 Handle `byte-discardN-preserve-tos' pseudo-op.
668 (byte-compile-top-level): If there are lexical args, output a TAG
669 op to record the initial stack-depth for the optimizer.
671 2002-08-17 Miles Bader <miles@gnu.org>
673 * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
674 (byte-compile-lapcode): Include byte-discardN.
675 (byte-compile-lambda): Fixup closure detection.
676 (byte-compile-top-level): Handle arguments for a lexical lambda.
677 (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
678 (byte-compile-variable-set): Use byte-compile-stack-set/ref.
679 (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
680 (byte-compile-stack-ref, byte-compile-stack-set): New functions.
681 (byte-compile-push-binding-init): Get the variable list properly
684 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
685 Ignore setq'd variables we're not interested in.
686 (byte-compile-make-lambda-lexenv): Add assertion that closed-over
687 variables be heap allocated.
688 (byte-compile-closure-initial-lexenv-p): Rename from
689 byte-compile-closure-lexenv-p.
690 (byte-compile-non-stack-bindings-p): Get the variable list
691 properly from LFORMINFO.
692 (byte-compile-maybe-push-heap-environment): Handle the
693 no-closed-over-variables case correctly.
694 (byte-compile-bind): Use byte-compile-stack-set/ref.
695 Don't bother modifying INIT-LEXENV as no one will see the changes.
696 (byte-compile-unbind): Call `byte-compile-discard' to handle
697 unbinding lexical bindings.
699 * emacs-lisp/disass.el (disassemble-internal): Handle closures.
700 (disassemble-1): Handle new bytecodes.
701 * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
703 2002-06-16 Miles Bader <miles@gnu.org>
705 * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
706 (macroexpand-all-forms, macroexpand-all-clauses): Use it.
707 * Makefile.in (compile): Undo previous change.
709 2002-06-14 Miles Bader <miles@gnu.org>
711 * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
712 (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
713 with an increased max-lisp-eval-depth.
715 * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
716 beginning of the file. Require `byte-lexbind' at compile time.
717 Add a few doc string.
718 (byte-compile-push-bytecodes)
719 (byte-compile-push-bytecode-const2): New macros.
720 (byte-compile-lapcode): Use them. Do general code cleanup.
721 (byte-compile-initial-macro-environment): Expand macros in
722 byte-compile-eval before passing to byte-compile-top-level.
723 (byte-compile): Use the `byte-compile-initial-macro-environment'.
725 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
727 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
729 (byte-compile-maybe-push-heap-environment): Fix function name typo.
731 2002-06-13 Miles Bader <miles@gnu.org>
733 Byte compiler lexical binding support (not finished yet):
734 * emacs-lisp/bytecomp.el: Require `macroexp'.
735 (byte-compile-lexical-environment)
736 (byte-compile-current-heap-environment)
737 (byte-compile-current-num-closures): New variables.
738 (0, 178, 179, 180, 181): New byte-opcodes.
739 (byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
740 error if a delay-output placeholder is not filled in yet.
741 (byte-compile-file-form, byte-compile): Expand all macros with
743 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
745 (byte-compile-make-lambda-lexenv): Autoload.
746 (byte-compile-lambda): Initial code for handling lexically-bound
747 arguments and closures; doesn't work yet.
748 (byte-compile-closure-code-p, byte-compile-make-closure)
749 (byte-compile-closure): New functions.
750 (byte-compile-check-variable, byte-compile-dynamic-variable-op)
751 (byte-compile-dynamic-variable-bind)
752 (byte-compile-lexical-variable-ref, byte-compile-variable-set):
754 (byte-compile-variable-ref): Remove second argument. Now only
755 handles real variable references (not setting or binding).
756 (byte-compile-push-unknown-constant)
757 (byte-compile-resolve-unknown-constant): New functions.
758 (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
759 (byte-compile-function-form): Use either `byte-compile-constant'
760 or `byte-compile-closure'.
761 (byte-compile-setq): Use `byte-compile-variable-set' instead of
762 `byte-compile-variable-ref'.
763 (apply, mapcar, mapatoms, mapconcat, mapc, sort):
764 `byte-defop-compiler-1's removed.
765 (byte-compile-while): Make sure lexically-bound variables inside
766 the loop don't get stored in an environment outside the loop.
767 (byte-compile-compute-lforminfo): Autoload.
768 (byte-compile-push-binding-init): New function.
769 (byte-compile-let, byte-compile-let*): Handle lexical binding.
770 (byte-compile-defun): Use `byte-compile-closure' to do the work.
771 (byte-compile-defmacro): Use `byte-compile-make-closure'.
772 (byte-compile-defvar): Expand the generated call to `push' since
773 we're past macroexpansion already.
774 (byte-compile-stack-adjustment): New function.
775 (byte-compile-out): Make second arg optional. Rewrite for clarity.
776 (byte-compile-delay-out, byte-compile-delayed-out): New functions.
778 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
779 Don't expand macros here.
781 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
783 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
784 (byte-compile-lforminfo-add-var)
785 (byte-compile-lforminfo-note-closure)
786 (byte-compile-compute-lforminfo)
787 (byte-compile-lforminfo-from-lambda)
788 (byte-compile-lforminfo-analyze)
789 (byte-compile-heapenv-add-accessible-env)
790 (byte-compile-heapenv-ensure-access)
791 (byte-compile-rearrange-let-clauses, byte-compile-bind)
792 (byte-compile-unbind): Fix a bunch of typos.
794 2002-06-12 Miles Bader <miles@gnu.org>
796 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
798 * subr.el (functionp): Function removed (now a subr).
799 * help-fns.el (describe-function-1): Handle interpreted closures.
801 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70