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