* doc/lispref/variables.texi (Scope): Mention the availability of lexbind.
[bpt/emacs.git] / lisp / ChangeLog
1 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
4 (cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
5 (cconv-analyse-use): Improve unused vars warnings.
6 (cconv-analyse-form): Analyze interactive spec in empty lexenv.
7 * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
8 the interactive spec in lexical-binding mode.
9 (byte-compile-refresh-preloaded): Don't reload byte-compiler files.
10 * custom.el (custom-initialize-default): Use defvar.
11 (custom-declare-variable): Set the special-variable-p flag.
12 * help-fns.el (help-make-usage): Drop leading underscores.
13 * dired.el (dired-revert, dired-make-relative): Mark unused args.
14 (dired-unmark-all-files): Remove unused var `query'.
15 (dired-overwrite-confirmed): Declare.
16 (dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
17 * mpc.el: Mark unused args.
18 (mpc--faster-toggle): Remove unused var `songnb'.
19 * server.el (server-kill-buffer-running): Move before first use.
20 * minibuffer.el: Mark unused args.
21
22 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
23
24 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
25 λ-lift candidates that end up not λ-lifted.
26
27 * emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
28 (cconv-mutated, cconv-captured): Remove.
29 (cconv-captured+mutated, cconv-lambda-candidates): Don't give them
30 a global value.
31 (cconv-freevars-alist): New var.
32 (cconv-freevars): Remove.
33 (cconv--lookup-let): Remove.
34 (cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
35 (cconv-closure-convert-rec): Adjust to above changes.
36 (fboundp): New function.
37 (cconv-analyse-function, form): Rewrite.
38 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
39 Handle declare-function here.
40 (byte-compile-obsolete): Remove.
41 (byte-compile-arglist-warn): Check late defsubst here.
42 (byte-compile-file-form): Simplify.
43 (byte-compile-file-form-defsubst): Remove.
44 (byte-compile-macroexpand-declare-function): Rename from
45 byte-compile-declare-function, turn it into a macro-expander.
46 (byte-compile-normal-call): Check obsolescence.
47 (byte-compile-quote-form): Remove.
48 (byte-compile-defmacro): Revert to trunk's definition which seems to
49 work just as well and handles `declare'.
50 * emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
51 * Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
52 (compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
53 * emacs-lisp/macroexp.el: Use lexbind.
54 (macroexpand-all-1): Check macro obsolescence.
55 * vc/diff-mode.el: Use lexbind.
56 * follow.el (follow-calc-win-end): Simplify.
57
58 2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
59
60 * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
61 `byte-constant'.
62 (byte-compile-close-variables, displaying-byte-compile-warnings):
63 Add edebug spec.
64 (byte-compile-toplevel-file-form): New fun, split out of
65 byte-compile-file-form.
66 (byte-compile-from-buffer): Use it to avoid applying cconv
67 multiple times.
68 (byte-compile): Only strip `function' if it's present.
69 (byte-compile-lambda): Add `reserved-csts' argument.
70 Use new lexenv arg of byte-compile-top-level.
71 (byte-compile-reserved-constants): New var.
72 (byte-compile-constants-vector): Obey it.
73 (byte-compile-constants-vector): Handle new `byte-constant' form.
74 (byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
75 (byte-compile-form): Don't check callargs here.
76 (byte-compile-normal-call): Do it here instead.
77 (byte-compile-push-unknown-constant)
78 (byte-compile-resolve-unknown-constant): Remove, unused.
79 (byte-compile-make-closure): Use `make-byte-code' rather than `curry',
80 putting the environment into the "constant" pool.
81 (byte-compile-get-closed-var): Use special byte-constant.
82 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
83 intermediate special form `internal-make-vector'.
84 (byte-optimize-lapcode): Handle new form of `byte-constant'.
85 * help-fns.el (describe-function-1): Don't handle funvecs.
86 * emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
87 function if the content is a lambda expression, not if it's a closure.
88 * emacs-lisp/eieio-come.el: Remove.
89 * emacs-lisp/eieio.el: Don't require eieio-comp.
90 (defmethod): Do a bit more work to find the body and wrap it into
91 a function before passing it to eieio-defmethod.
92 (eieio-defmethod): New arg `code' for it.
93 * emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
94 debugger backtrace.
95 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
96 more careful when quoting a function value.
97 * emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
98 (cconv-closure-convert-rec): Catch stray `internal-make-closure'.
99 * Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
100
101 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
102
103 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
104 compiler choose the representation of closures.
105 (cconv--env-var): Remove.
106 * emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
107 (byte-compile-make-closure, byte-compile-get-closed-var):
108 New functions.
109
110 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
111
112 * subr.el (with-output-to-temp-buffer): New macro.
113
114 * simple.el (count-words-region): Don't use interactive-p.
115
116 * minibuffer.el: Use lexical-binding. Replace all uses of lexical-let.
117
118 * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
119 Call byte-compile rather than byte-compile-lambda.
120
121 * emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
122 Rename from byte-compile-file-form-defmethod.
123 Don't byte-compile-lambda.
124 (eieio-byte-compile-defmethod-param-convert): Rename from
125 byte-compile-defmethod-param-convert.
126
127 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
128 value of (function (lambda ...)) is self-quoting.
129
130 * emacs-lisp/cconv.el: Use lexical-binding.
131 (cconv--lookup-let): Rename from cconv-lookup-let.
132 (cconv-closure-convert-rec): Fix handling of captured+mutated
133 arguments in defun/defmacro.
134
135 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
136 Turn stack-ref-0 into dup.
137 (byte-compile-form): Don't indirect-function since it can signal
138 errors.
139 (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
140 being relative to top rather than to bottom in the byte-code.
141 (with-output-to-temp-buffer): Remove.
142 (byte-compile-with-output-to-temp-buffer): Remove.
143
144 * emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
145 Remove interactive-p.
146 (byte-optimize-lapcode): Update optimizations now that stack-refs are
147 relative to the top rather than to the bottom.
148
149 2011-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
150
151 * subr.el (save-window-excursion): New macro, moved from C.
152 * emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
153 * emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
154 Don't handle save-window-excursion any more.
155 * emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
156 Don't use the byte-code any more.
157 (byte-compile-form): Check macro expansion was done.
158 (byte-compile-save-window-excursion): Remove.
159 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
160 Ignore save-window-excursion. Don't macroepand any more.
161
162 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
163
164 * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
165 Avoid destructuring-bind which results in poorer code.
166
167 2011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
168
169 * files.el (lexical-binding): Add a safe-local-variable property.
170
171 * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
172 in lexbind, because it needs a different implementation.
173
174 * emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
175 (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
176 (cconv--env-var): New constant.
177 (cconv-closure-convert-rec): Use it and use them. Fix a typo that
178 ended up forgetting to remove entries from lmenvs in `let'.
179 For `lambda' use the outer `fvrs' when building the closure and don't
180 forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
181
182 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
183 Correctly extract arglist from `closure's.
184 (byte-compile-cl-warn): Compiler-macros are run earlier now.
185 (byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
186 except for lambdas.
187 (byte-compile-form): Don't run the compiler-macro expander here.
188 (byte-compile-let): Merge with byte-compile-let*.
189 Don't preserve-body-value if the body's value was discarded.
190
191 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
192 are added to the stack.
193 (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
194 byte-compile-depth now that byte-inline-lapcode does it for us.
195 (byte-compile-inline-expand): Don't inline dynbind byte code into
196 lexbind code, since it has to be done differently.
197
198 2011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
199
200 * emacs-lisp/byte-lexbind.el: Delete.
201
202 * emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
203 (byte-compile-current-num-closures): Remove vars.
204 (byte-vec-ref, byte-vec-set): Remove byte codes.
205 (byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
206 byte-lexbind.el.
207 (byte-compile-lambda): Never build a closure.
208 (byte-compile-closure-code-p, byte-compile-make-closure): Remove.
209 (byte-compile-closure): Simplify.
210 (byte-compile-top-level): Don't mess with heap environments.
211 (byte-compile-dynamic-variable-bind): Always maintain
212 byte-compile-bound-variables.
213 (byte-compile-variable-ref, byte-compile-variable-set): Always just use
214 the stack for lexical vars.
215 (byte-compile-push-binding-init): Simplify.
216 (byte-compile-not-lexical-var-p): New function, moved from cconv.el.
217 (byte-compile-bind, byte-compile-unbind): New functions, moved and
218 simplified from byte-lexbind.el.
219 (byte-compile-let, byte-compile-let*): Simplify.
220 (byte-compile-condition-case): Don't add :fun-body to the bound vars.
221 (byte-compile-defmacro): Simplify.
222
223 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
224 (cconv-freevars, cconv-analyse-function, cconv-analyse-form):
225 Use byte-compile-not-lexical-var-p instead.
226
227 * help-fns.el (describe-function-1): Fix paren typo.
228
229 * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
230 (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
231
232 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
233
234 * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
235 (cconv-closure-convert-toplevel): Remove.
236 (cconv-lookup-let): New fun.
237 (cconv-closure-convert-rec): Don't bother with defs-are-legal.
238 Use :fun-body to handle special forms that require closing their forms.
239
240 * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
241 Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
242 (byte-compile-lambda, byte-compile-make-closure):
243 * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
244 Make sure cconv did its job.
245
246 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
247 before using it.
248
249 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
250 function argument.
251
252 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
253
254 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
255 renamed to `bytecomp-fun'.
256
257 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
258 Understand the :fun-body case for catch, save-window-excursion, and
259 condition-case.
260 (byte-compile-maybe-push-heap-environment): No need when nclosures is
261 zero and byte-compile-current-num-closures is -1.
262
263 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
264 (cconv-freevars): Use it.
265 (cconv-closure-convert-rec): Avoid `position'.
266 (cconv-analyse-function): New function.
267 (cconv-analyse-form): Use it. `inclosure' can't be nil any more.
268 Check lexical vars at let-binding time rather than when referenced.
269 For defuns to be in an empty environment and lambdas to take lexical args.
270 Pay attention to the need to build closures in catch, unwind-protect,
271 save-window-excursion, condition-case, and track-mouse.
272 Fix defconst/defvar handling.
273
274 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
275
276 * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
277 (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
278 (cconv-freevars): Minor cleanup. Fix handling of the error var in
279 condition-case.
280
281 * emacs-lisp/bytecomp.el (byte-compile-catch)
282 (byte-compile-unwind-protect, byte-compile-track-mouse)
283 (byte-compile-condition-case, byte-compile-save-window-excursion):
284 Provide a :fun-body alternative, so that info can be propagated from the
285 surrounding context, as is the case for lexical scoping.
286
287 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
288
289 * emacs-lisp/cconv.el: New file.
290 * emacs-lisp/bytecomp.el: Use cconv.
291 (byte-compile-file-form, byte-compile):
292 Call cconv-closure-convert-toplevel when requested.
293 * server.el:
294 * mpc.el:
295 * emacs-lisp/pcase.el:
296 * doc-view.el:
297 * dired.el: Use lexical-binding.
298
299 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
300
301 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
302
303 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
304
305 * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
306 * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
307 * ielm.el (ielm-eval-input):
308 * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
309
310 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
311
312 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
313
314 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
315
316 * subr.el (with-lexical-binding): Remove.
317
318 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
319
320 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
321 specialp -> special-variable-p.
322
323 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
324
325 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
326 Don't macroexpand before evaluating in eval-and-compile, in case
327 `body's macro expansion uses macros and functions defined in itself.
328
329 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
330
331 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
332 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
333
334 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
335
336 2006-12-04 Miles Bader <miles@gnu.org>
337
338 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
339 (compile, compile-always): Use it.
340
341 2005-10-24 Miles Bader <miles@gnu.org>
342
343 * subr.el (functionp): Re-remove.
344
345 * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
346 ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
347 (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
348 instead of adding lambda ourselves.
349
350 2004-08-09 Miles Bader <miles@gnu.org>
351
352 Changes from merging the funvec patch:
353
354 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
355 instead of `vector' to create compiled closures.
356
357 Merge funvec patch.
358
359 2004-05-20 Miles Bader <miles@gnu.org>
360
361 * subr.el (functionp): Use `funvecp' instead of
362 `byte-compiled-function-p'.
363 * help-fns.el (describe-function-1): Describe curried functions
364 and other funvecs as such.
365 (help-highlight-arguments): Only format things that look like a
366 function.
367
368 2004-04-29 Miles Bader <miles@gnu.org>
369
370 * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
371 to `byte-compile-lexical-environment' at the start, not end.
372 (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
373
374 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
375 Don't crash on no-op lapcode entries (car is nil).
376
377 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
378 Push a lexvar onto lexenv, not a vinfo!
379
380 2004-04-11 Miles Bader <miles@gnu.org>
381
382 * emacs-lisp/bytecomp.el (byte-compile-top-level):
383 Correctly analyze lexically-bound arguments.
384
385 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
386 Use `append' instead of `nconc'.
387
388 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
389 Don't use backquote to make a mutable data-structure.
390 (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
391 Rename to use `num-' instead of `num'.
392 (byte-compile-make-lambda-lexenv): Adjust accordingly.
393
394 2004-04-10 Miles Bader <miles@gnu.org>
395
396 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
397 Look at variable's global specialp state too.
398
399 2004-04-09 Miles Bader <miles@gnu.org>
400
401 * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
402 Default initial-stack-depth to 0.
403 (byte-optimize-lapcode): Discard the right number of values in
404 the stack-set+discard-->discard optimization.
405
406 2004-04-02 Miles Bader <miles@gnu.org>
407
408 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
409 environment if lexical-binding is enabled.
410
411 2003-10-14 Miles Bader <miles@gnu.org>
412
413 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
414 `backquote-list*' to avoid stack overflows.
415
416 2003-04-04 Miles Bader <miles@gnu.org>
417
418 * help-fns.el (help-function-arglist): Handle interpreted closures.
419
420 2002-11-20 Miles Bader <miles@gnu.org>
421
422 * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
423 Correctly handle discardN* operators.
424 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
425 tracking errors.
426
427 2002-08-26 Miles Bader <miles@gnu.org>
428
429 * international/mule.el (make-char): Macroexpand call to
430 charset-id constructed by `byte-compile' hook.
431
432 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
433
434 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
435 (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
436 Add more optimizations for lexical binding.
437 (byte-compile-inline-expand): Macroexpand result of inlining.
438
439 * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
440 byte-compile-closure-initial-lexenv-p.
441 (byte-discardN-preserve-tos): Alias to byte-discardN.
442 (byte-compile-push-binding-init): Don't push unused variables on
443 init-lexenv.
444 (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
445 (byte-compile-lambda): Don't look at lexical environment unless
446 we're using lexical binding.
447 (byte-compile-defmacro): Correctly generate macros.
448
449 * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
450 dynamic-bindings-only case.
451 (byte-compile-bind): Don't special-case unused lexical variables.
452
453 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
454
455 2002-08-19 Miles Bader <miles@gnu.org>
456
457 * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
458 Handle `byte-discardN-preserve-tos' pseudo-op.
459 (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
460 (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
461 (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
462 Add tracking of stack-depth. Unfinished code to collapse
463 lexical-unbinding sequences.
464
465 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
466 Handle `byte-discardN-preserve-tos' pseudo-op.
467 (byte-compile-top-level): If there are lexical args, output a TAG
468 op to record the initial stack-depth for the optimizer.
469
470 2002-08-17 Miles Bader <miles@gnu.org>
471
472 * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
473 (byte-compile-lapcode): Include byte-discardN.
474 (byte-compile-lambda): Fixup closure detection.
475 (byte-compile-top-level): Handle arguments for a lexical lambda.
476 (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
477 (byte-compile-variable-set): Use byte-compile-stack-set/ref.
478 (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
479 (byte-compile-stack-ref, byte-compile-stack-set): New functions.
480 (byte-compile-push-binding-init): Get the variable list properly
481 from LFORMINFO.
482
483 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
484 Ignore setq'd variables we're not interested in.
485 (byte-compile-make-lambda-lexenv): Add assertion that closed-over
486 variables be heap allocated.
487 (byte-compile-closure-initial-lexenv-p): Rename from
488 byte-compile-closure-lexenv-p.
489 (byte-compile-non-stack-bindings-p): Get the variable list
490 properly from LFORMINFO.
491 (byte-compile-maybe-push-heap-environment): Handle the
492 no-closed-over-variables case correctly.
493 (byte-compile-bind): Use byte-compile-stack-set/ref.
494 Don't bother modifying INIT-LEXENV as no one will see the changes.
495 (byte-compile-unbind): Call `byte-compile-discard' to handle
496 unbinding lexical bindings.
497
498 * emacs-lisp/disass.el (disassemble-internal): Handle closures.
499 (disassemble-1): Handle new bytecodes.
500 * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
501
502 2002-06-16 Miles Bader <miles@gnu.org>
503
504 * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
505 (macroexpand-all-forms, macroexpand-all-clauses): Use it.
506 * Makefile.in (compile): Undo previous change.
507
508 2002-06-14 Miles Bader <miles@gnu.org>
509
510 * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
511 (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
512 with an increased max-lisp-eval-depth.
513
514 * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
515 beginning of the file. Require `byte-lexbind' at compile time.
516 Add a few doc string.
517 (byte-compile-push-bytecodes)
518 (byte-compile-push-bytecode-const2): New macros.
519 (byte-compile-lapcode): Use them. Do general code cleanup.
520 (byte-compile-initial-macro-environment): Expand macros in
521 byte-compile-eval before passing to byte-compile-top-level.
522 (byte-compile): Use the `byte-compile-initial-macro-environment'.
523
524 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
525 `bytecomp'.
526 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
527 dynamic variables.
528 (byte-compile-maybe-push-heap-environment): Fix function name typo.
529
530 2002-06-13 Miles Bader <miles@gnu.org>
531
532 Byte compiler lexical binding support (not finished yet):
533 * emacs-lisp/bytecomp.el: Require `macroexp'.
534 (byte-compile-lexical-environment)
535 (byte-compile-current-heap-environment)
536 (byte-compile-current-num-closures): New variables.
537 (0, 178, 179, 180, 181): New byte-opcodes.
538 (byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
539 error if a delay-output placeholder is not filled in yet.
540 (byte-compile-file-form, byte-compile): Expand all macros with
541 `macroexpand-all'.
542 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
543 macros here.
544 (byte-compile-make-lambda-lexenv): Autoload.
545 (byte-compile-lambda): Initial code for handling lexically-bound
546 arguments and closures; doesn't work yet.
547 (byte-compile-closure-code-p, byte-compile-make-closure)
548 (byte-compile-closure): New functions.
549 (byte-compile-check-variable, byte-compile-dynamic-variable-op)
550 (byte-compile-dynamic-variable-bind)
551 (byte-compile-lexical-variable-ref, byte-compile-variable-set):
552 New functions.
553 (byte-compile-variable-ref): Remove second argument. Now only
554 handles real variable references (not setting or binding).
555 (byte-compile-push-unknown-constant)
556 (byte-compile-resolve-unknown-constant): New functions.
557 (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
558 (byte-compile-function-form): Use either `byte-compile-constant'
559 or `byte-compile-closure'.
560 (byte-compile-setq): Use `byte-compile-variable-set' instead of
561 `byte-compile-variable-ref'.
562 (apply, mapcar, mapatoms, mapconcat, mapc, sort):
563 `byte-defop-compiler-1's removed.
564 (byte-compile-while): Make sure lexically-bound variables inside
565 the loop don't get stored in an environment outside the loop.
566 (byte-compile-compute-lforminfo): Autoload.
567 (byte-compile-push-binding-init): New function.
568 (byte-compile-let, byte-compile-let*): Handle lexical binding.
569 (byte-compile-defun): Use `byte-compile-closure' to do the work.
570 (byte-compile-defmacro): Use `byte-compile-make-closure'.
571 (byte-compile-defvar): Expand the generated call to `push' since
572 we're past macroexpansion already.
573 (byte-compile-stack-adjustment): New function.
574 (byte-compile-out): Make second arg optional. Rewrite for clarity.
575 (byte-compile-delay-out, byte-compile-delayed-out): New functions.
576
577 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
578 Don't expand macros here.
579
580 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
581
582 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
583 (byte-compile-lforminfo-add-var)
584 (byte-compile-lforminfo-note-closure)
585 (byte-compile-compute-lforminfo)
586 (byte-compile-lforminfo-from-lambda)
587 (byte-compile-lforminfo-analyze)
588 (byte-compile-heapenv-add-accessible-env)
589 (byte-compile-heapenv-ensure-access)
590 (byte-compile-rearrange-let-clauses, byte-compile-bind)
591 (byte-compile-unbind): Fix a bunch of typos.
592
593 2002-06-12 Miles Bader <miles@gnu.org>
594
595 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
596
597 * subr.el (functionp): Function removed (now a subr).
598 * help-fns.el (describe-function-1): Handle interpreted closures.
599
600 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70