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