diff options
| author | Stefan Monnier | 2010-04-20 13:35:16 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-04-20 13:35:16 -0400 |
| commit | 8b1e1112af27d900fdaeff47af5120639661e821 (patch) | |
| tree | 442c47633970c2e8656420e73ca753dc8b995f76 /src/data.c | |
| parent | 933ac235bd586814f0ac49aac4f385083c1dd5a8 (diff) | |
| download | emacs-8b1e1112af27d900fdaeff47af5120639661e821.tar.gz emacs-8b1e1112af27d900fdaeff47af5120639661e821.zip | |
Warn rather than error when making a local var inside a let.
* data.c (Fmake_variable_buffer_local, Fmake_local_variable):
Just signal a warning rather than an error when inside a let.
(Fmake_variable_frame_local): Add the same test.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/data.c b/src/data.c index a56b112196d..43d168cc63d 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1639,8 +1639,8 @@ The function `default-value' gets the default value and `set-default' sets it. | |||
| 1639 | Lisp_Object symbol; | 1639 | Lisp_Object symbol; |
| 1640 | XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ | 1640 | XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ |
| 1641 | if (let_shadows_global_binding_p (symbol)) | 1641 | if (let_shadows_global_binding_p (symbol)) |
| 1642 | error ("Making %s buffer-local while let-bound!", | 1642 | message ("Making %s buffer-local while let-bound!", |
| 1643 | SDATA (SYMBOL_NAME (variable))); | 1643 | SDATA (SYMBOL_NAME (variable))); |
| 1644 | } | 1644 | } |
| 1645 | } | 1645 | } |
| 1646 | 1646 | ||
| @@ -1702,7 +1702,8 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1702 | } | 1702 | } |
| 1703 | 1703 | ||
| 1704 | if (sym->constant) | 1704 | if (sym->constant) |
| 1705 | error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); | 1705 | error ("Symbol %s may not be buffer-local", |
| 1706 | SDATA (SYMBOL_NAME (variable))); | ||
| 1706 | 1707 | ||
| 1707 | if (blv ? blv->local_if_set | 1708 | if (blv ? blv->local_if_set |
| 1708 | : (forwarded && BUFFER_OBJFWDP (valcontents.fwd))) | 1709 | : (forwarded && BUFFER_OBJFWDP (valcontents.fwd))) |
| @@ -1722,8 +1723,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1722 | Lisp_Object symbol; | 1723 | Lisp_Object symbol; |
| 1723 | XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ | 1724 | XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ |
| 1724 | if (let_shadows_global_binding_p (symbol)) | 1725 | if (let_shadows_global_binding_p (symbol)) |
| 1725 | error ("Making %s local to %s while let-bound!", | 1726 | message ("Making %s local to %s while let-bound!", |
| 1726 | SDATA (SYMBOL_NAME (variable)), SDATA (current_buffer->name)); | 1727 | SDATA (SYMBOL_NAME (variable)), |
| 1728 | SDATA (current_buffer->name)); | ||
| 1727 | } | 1729 | } |
| 1728 | } | 1730 | } |
| 1729 | 1731 | ||
| @@ -1899,6 +1901,13 @@ frame-local bindings). */) | |||
| 1899 | blv->frame_local = 1; | 1901 | blv->frame_local = 1; |
| 1900 | sym->redirect = SYMBOL_LOCALIZED; | 1902 | sym->redirect = SYMBOL_LOCALIZED; |
| 1901 | SET_SYMBOL_BLV (sym, blv); | 1903 | SET_SYMBOL_BLV (sym, blv); |
| 1904 | { | ||
| 1905 | Lisp_Object symbol; | ||
| 1906 | XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */ | ||
| 1907 | if (let_shadows_global_binding_p (symbol)) | ||
| 1908 | message ("Making %s frame-local while let-bound!", | ||
| 1909 | SDATA (SYMBOL_NAME (variable))); | ||
| 1910 | } | ||
| 1902 | return variable; | 1911 | return variable; |
| 1903 | } | 1912 | } |
| 1904 | 1913 | ||