* lisp/subr.el (apply-partially): Use a non-nil static environment.
[bpt/emacs.git] / lisp / ChangeLog
1 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
2
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.
7
8 * emacs-lisp/edebug.el (edebug-eval-top-level-form):
9 Use eval-sexp-add-defvars.
10
11 2011-03-30 Juanma Barranquero <lekktu@gmail.com>
12
13 * makefile.w32-in (COMPILE_FIRST): Remove pcase.
14
15 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * subr.el (with-output-to-temp-buffer): Don't change current-buffer to
18 standard-output while running the body.
19
20 * startup.el: Fix up warnings, move lambda expressions
21 outside of quote.
22
23 * Makefile.in (COMPILE_FIRST): Remove pcase; it's not so important.
24
25 2011-03-24 Stefan Monnier <monnier@iro.umontreal.ca>
26
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
29 scoping instead.
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.
36
37 2011-03-23 Stefan Monnier <monnier@iro.umontreal.ca>
38
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
54 functions.
55 (byte-compile-unfold-lambda): Don't handle byte-compiled functions
56 at all.
57 (byte-optimize-form-code-walker): Don't optimize byte-compiled inlined
58 functions here.
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'.
63
64 2011-03-20 Christian Ohler <ohler@gnu.org>
65
66 * emacs-lisp/cl-macs.el (cl-block-wrapper): Fix typo that broke CL
67 blocks.
68
69 2011-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
70
71 * emacs-lisp/debug.el (debugger-setup-buffer): Revert local change to
72 print depth and length.
73
74 2011-03-19 Stefan Monnier <monnier@iro.umontreal.ca>
75
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.
81
82 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
83
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.
89
90 * emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use
91 lexical-binding.
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.
95
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.
101
102 2011-03-15 Stefan Monnier <monnier@iro.umontreal.ca>
103
104 * makefile.w32-in (COMPILE_FIRST): Fix up last change.
105 * ldefs-boot.el: Revert to upstream's version.
106
107 2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
108
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.
113
114 2011-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
115
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):
129 Use it.
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.
139
140 2011-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
141
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'
148 in defmacros.
149 * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
150 Handle `declare'.
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.
160 * vc/smerge-mode.el:
161 * vc/log-view.el:
162 * vc/log-edit.el:
163 * vc/cvs-status.el:
164 * uniquify.el:
165 * textmodes/css-mode.el:
166 * textmodes/bibtex-style.el:
167 * reveal.el:
168 * newcomment.el:
169 * emacs-lisp/smie.el:
170 * abbrev.el: Use lexical-binding.
171
172 2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
173
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.
189
190 * subr.el (functionp): Remove, now that it's in src/eval.c.
191
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.
198
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.
208
209 2011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
210
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.
225
226 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
227
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.
246
247 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
248
249 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
250 λ-lift candidates that end up not λ-lifted.
251
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
255 a global value.
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.
282
283 2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
284
285 * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
286 `byte-constant'.
287 (byte-compile-close-variables, displaying-byte-compile-warnings):
288 Add edebug spec.
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
292 multiple times.
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
319 debugger backtrace.
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.
325
326 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
327
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):
333 New functions.
334
335 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
336
337 * subr.el (with-output-to-temp-buffer): New macro.
338
339 * simple.el (count-words-region): Don't use interactive-p.
340
341 * minibuffer.el: Use lexical-binding. Replace all uses of lexical-let.
342
343 * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
344 Call byte-compile rather than byte-compile-lambda.
345
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.
351
352 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
353 value of (function (lambda ...)) is self-quoting.
354
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.
359
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
363 errors.
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.
368
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.
373
374 2011-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
375
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.
386
387 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
388
389 * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
390 Avoid destructuring-bind which results in poorer code.
391
392 2011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
393
394 * files.el (lexical-binding): Add a safe-local-variable property.
395
396 * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
397 in lexbind, because it needs a different implementation.
398
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.
406
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,
411 except for lambdas.
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.
415
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.
422
423 2011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
424
425 * emacs-lisp/byte-lexbind.el: Delete.
426
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
431 byte-lexbind.el.
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.
447
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.
451
452 * help-fns.el (describe-function-1): Fix paren typo.
453
454 * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
455 (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
456
457 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
458
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.
464
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.
470
471 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
472 before using it.
473
474 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
475 function argument.
476
477 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
478
479 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
480 renamed to `bytecomp-fun'.
481
482 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
483 Understand the :fun-body case for catch, save-window-excursion, and
484 condition-case.
485 (byte-compile-maybe-push-heap-environment): No need when nclosures is
486 zero and byte-compile-current-num-closures is -1.
487
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.
498
499 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
500
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
504 condition-case.
505
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.
511
512 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
513
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.
518 * server.el:
519 * mpc.el:
520 * emacs-lisp/pcase.el:
521 * doc-view.el:
522 * dired.el: Use lexical-binding.
523
524 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
525
526 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
527
528 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
529
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.
534
535 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
536
537 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
538
539 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
540
541 * subr.el (with-lexical-binding): Remove.
542
543 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
544
545 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
546 specialp -> special-variable-p.
547
548 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
549
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.
553
554 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
555
556 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
557 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
558
559 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
560
561 2006-12-04 Miles Bader <miles@gnu.org>
562
563 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
564 (compile, compile-always): Use it.
565
566 2005-10-24 Miles Bader <miles@gnu.org>
567
568 * subr.el (functionp): Re-remove.
569
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.
574
575 2004-08-09 Miles Bader <miles@gnu.org>
576
577 Changes from merging the funvec patch:
578
579 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
580 instead of `vector' to create compiled closures.
581
582 Merge funvec patch.
583
584 2004-05-20 Miles Bader <miles@gnu.org>
585
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
591 function.
592
593 2004-04-29 Miles Bader <miles@gnu.org>
594
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.
598
599 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
600 Don't crash on no-op lapcode entries (car is nil).
601
602 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
603 Push a lexvar onto lexenv, not a vinfo!
604
605 2004-04-11 Miles Bader <miles@gnu.org>
606
607 * emacs-lisp/bytecomp.el (byte-compile-top-level):
608 Correctly analyze lexically-bound arguments.
609
610 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
611 Use `append' instead of `nconc'.
612
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.
618
619 2004-04-10 Miles Bader <miles@gnu.org>
620
621 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
622 Look at variable's global specialp state too.
623
624 2004-04-09 Miles Bader <miles@gnu.org>
625
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.
630
631 2004-04-02 Miles Bader <miles@gnu.org>
632
633 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
634 environment if lexical-binding is enabled.
635
636 2003-10-14 Miles Bader <miles@gnu.org>
637
638 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
639 `backquote-list*' to avoid stack overflows.
640
641 2003-04-04 Miles Bader <miles@gnu.org>
642
643 * help-fns.el (help-function-arglist): Handle interpreted closures.
644
645 2002-11-20 Miles Bader <miles@gnu.org>
646
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
650 tracking errors.
651
652 2002-08-26 Miles Bader <miles@gnu.org>
653
654 * international/mule.el (make-char): Macroexpand call to
655 charset-id constructed by `byte-compile' hook.
656
657 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
658
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.
663
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
668 init-lexenv.
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.
673
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.
677
678 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
679
680 2002-08-19 Miles Bader <miles@gnu.org>
681
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.
689
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.
694
695 2002-08-17 Miles Bader <miles@gnu.org>
696
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
706 from LFORMINFO.
707
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.
722
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.
726
727 2002-06-16 Miles Bader <miles@gnu.org>
728
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.
732
733 2002-06-14 Miles Bader <miles@gnu.org>
734
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.
738
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'.
748
749 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
750 `bytecomp'.
751 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
752 dynamic variables.
753 (byte-compile-maybe-push-heap-environment): Fix function name typo.
754
755 2002-06-13 Miles Bader <miles@gnu.org>
756
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
766 `macroexpand-all'.
767 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
768 macros here.
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):
777 New functions.
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.
801
802 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
803 Don't expand macros here.
804
805 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
806
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.
817
818 2002-06-12 Miles Bader <miles@gnu.org>
819
820 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
821
822 * subr.el (functionp): Function removed (now a subr).
823 * help-fns.el (describe-function-1): Handle interpreted closures.
824
825 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70