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