diff options
| author | Stefan Monnier | 2012-06-08 09:18:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-06-08 09:18:26 -0400 |
| commit | 513749ee1862278385028d6700e1d2ce8abd35e6 (patch) | |
| tree | cb835ce77cd2aa8d828dca57b55642e85f3942c5 /src | |
| parent | 595ef4ad76fb75db4a0adb2baf117ef6d68a2e41 (diff) | |
| download | emacs-513749ee1862278385028d6700e1d2ce8abd35e6.tar.gz emacs-513749ee1862278385028d6700e1d2ce8abd35e6.zip | |
Clean up scoping rule of predefined single-word vars.
* lisp/startup.el (argv, argi): Make lexically scoped.
* lisp/emacs-lisp/float-sup.el (pi): Use internal-make-var-non-special.
* lisp/emacs-lisp/cl-macs.el: Use lexical-binding.
Rename cl-bind-* to cl--bind-*.
* lisp/files.el: Don't require `cl' since it doesn't use it.
* lisp/emacs-lisp/pcase.el, lisp/emacs-lisp/macroexp.el: Add coding cookie.
* src/eval.c (Fmake_var_non_special): New primitive.
(syms_of_eval): Defsubr it.
* src/lread.c (syms_of_lread): Mark `values' as lexically scoped.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/eval.c | 12 | ||||
| -rw-r--r-- | src/lread.c | 7 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ff9664d208f..dd668212615 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-06-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * eval.c (Fmake_var_non_special): New primitive. | ||
| 4 | (syms_of_eval): Defsubr it. | ||
| 5 | * lread.c (syms_of_lread): Mark `values' as lexically scoped. | ||
| 6 | |||
| 1 | 2012-06-08 Juanma Barranquero <lekktu@gmail.com> | 7 | 2012-06-08 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * dispnew.c (showing_window_margins_p): Wrap in #if 0 to prevent unused | 9 | * dispnew.c (showing_window_margins_p): Wrap in #if 0 to prevent unused |
| @@ -23,7 +29,7 @@ | |||
| 23 | (roundup_size): New constant. | 29 | (roundup_size): New constant. |
| 24 | (struct vector_block): New data type. | 30 | (struct vector_block): New data type. |
| 25 | (vector_blocks, vector_free_lists, zero_vector): New variables. | 31 | (vector_blocks, vector_free_lists, zero_vector): New variables. |
| 26 | (all_vectors): Renamed to `large_vectors'. | 32 | (all_vectors): Rename to `large_vectors'. |
| 27 | (allocate_vector_from_block, init_vectors, allocate_vector_from_block) | 33 | (allocate_vector_from_block, init_vectors, allocate_vector_from_block) |
| 28 | (sweep_vectors): New functions. | 34 | (sweep_vectors): New functions. |
| 29 | (allocate_vectorlike): Return `zero_vector' as the only vector of | 35 | (allocate_vectorlike): Return `zero_vector' as the only vector of |
diff --git a/src/eval.c b/src/eval.c index 85ff3ae19e6..5a9327a99d8 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -790,6 +790,17 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | |||
| 790 | return sym; | 790 | return sym; |
| 791 | } | 791 | } |
| 792 | 792 | ||
| 793 | /* Make SYMBOL lexically scoped. */ | ||
| 794 | DEFUN ("internal-make-var-non-special", Fmake_var_non_special, | ||
| 795 | Smake_var_non_special, 1, 1, 0, | ||
| 796 | doc: /* Internal function. */) | ||
| 797 | (Lisp_Object symbol) | ||
| 798 | { | ||
| 799 | CHECK_SYMBOL (symbol); | ||
| 800 | XSYMBOL (symbol)->declared_special = 0; | ||
| 801 | return Qnil; | ||
| 802 | } | ||
| 803 | |||
| 793 | 804 | ||
| 794 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, | 805 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, |
| 795 | doc: /* Bind variables according to VARLIST then eval BODY. | 806 | doc: /* Bind variables according to VARLIST then eval BODY. |
| @@ -3582,6 +3593,7 @@ alist of active lexical bindings. */); | |||
| 3582 | defsubr (&Sdefvar); | 3593 | defsubr (&Sdefvar); |
| 3583 | defsubr (&Sdefvaralias); | 3594 | defsubr (&Sdefvaralias); |
| 3584 | defsubr (&Sdefconst); | 3595 | defsubr (&Sdefconst); |
| 3596 | defsubr (&Smake_var_non_special); | ||
| 3585 | defsubr (&Slet); | 3597 | defsubr (&Slet); |
| 3586 | defsubr (&SletX); | 3598 | defsubr (&SletX); |
| 3587 | defsubr (&Swhile); | 3599 | defsubr (&Swhile); |
diff --git a/src/lread.c b/src/lread.c index 38b00a66962..726f1f0e905 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -4375,7 +4375,8 @@ to find all the symbols in an obarray, use `mapatoms'. */); | |||
| 4375 | 4375 | ||
| 4376 | DEFVAR_LISP ("values", Vvalues, | 4376 | DEFVAR_LISP ("values", Vvalues, |
| 4377 | doc: /* List of values of all expressions which were read, evaluated and printed. | 4377 | doc: /* List of values of all expressions which were read, evaluated and printed. |
| 4378 | Order is reverse chronological. */); | 4378 | Order is reverse chronological. */); |
| 4379 | XSYMBOL (intern ("values"))->declared_special = 0; | ||
| 4379 | 4380 | ||
| 4380 | DEFVAR_LISP ("standard-input", Vstandard_input, | 4381 | DEFVAR_LISP ("standard-input", Vstandard_input, |
| 4381 | doc: /* Stream for read to get input from. | 4382 | doc: /* Stream for read to get input from. |
| @@ -4393,7 +4394,7 @@ defined, although they may be in the future. | |||
| 4393 | 4394 | ||
| 4394 | The positions are relative to the last call to `read' or | 4395 | The positions are relative to the last call to `read' or |
| 4395 | `read-from-string'. It is probably a bad idea to set this variable at | 4396 | `read-from-string'. It is probably a bad idea to set this variable at |
| 4396 | the toplevel; bind it instead. */); | 4397 | the toplevel; bind it instead. */); |
| 4397 | Vread_with_symbol_positions = Qnil; | 4398 | Vread_with_symbol_positions = Qnil; |
| 4398 | 4399 | ||
| 4399 | DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list, | 4400 | DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list, |
| @@ -4408,7 +4409,7 @@ symbol from the position where `read' or `read-from-string' started. | |||
| 4408 | 4409 | ||
| 4409 | Note that a symbol will appear multiple times in this list, if it was | 4410 | Note that a symbol will appear multiple times in this list, if it was |
| 4410 | read multiple times. The list is in the same order as the symbols | 4411 | read multiple times. The list is in the same order as the symbols |
| 4411 | were read in. */); | 4412 | were read in. */); |
| 4412 | Vread_symbol_positions_list = Qnil; | 4413 | Vread_symbol_positions_list = Qnil; |
| 4413 | 4414 | ||
| 4414 | DEFVAR_LISP ("read-circle", Vread_circle, | 4415 | DEFVAR_LISP ("read-circle", Vread_circle, |