aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorStefan Monnier2016-12-21 15:07:43 -0500
committerStefan Monnier2016-12-21 15:07:43 -0500
commita6063ffe5ae395655cb55ba5823c83e306b3161b (patch)
treeab44b1db51c5ae4e5ff65533b9eeba79de954460 /src/data.c
parentcf6ce9a1fe320ebe5b238af5f7af9416ac954855 (diff)
downloademacs-a6063ffe5ae395655cb55ba5823c83e306b3161b.tar.gz
emacs-a6063ffe5ae395655cb55ba5823c83e306b3161b.zip
* src/data.c (Fmake_variable_frame_local): Remove
* src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'. * src/data.c (swap_in_symval_forwarding, set_internal) (set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p): Don't pay attention to ->frame_local any more. (syms_of_data): Remove Qtrapping_frame_local and don't defsubr Smake_variable_frame_local. * etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal of make-variable-frame-local. * lisp/help-fns.el (describe-variable): Don't handle the now impossible frame-local case. * lisp/subr.el (make-variable-frame-local): Remove obsolescence data. * src/frame.c (store_frame_param): * src/eval.c (specbind): Don't pay attention to ->frame_local any more. * src/widget.c (first_frame_p): Remove, unused.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c133
1 files changed, 9 insertions, 124 deletions
diff --git a/src/data.c b/src/data.c
index 6dd346bf8df..821fc379374 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1176,9 +1176,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1176 tem1 = blv->where; 1176 tem1 = blv->where;
1177 1177
1178 if (NILP (tem1) 1178 if (NILP (tem1)
1179 || (blv->frame_local 1179 || current_buffer != XBUFFER (tem1))
1180 ? !EQ (selected_frame, tem1)
1181 : current_buffer != XBUFFER (tem1)))
1182 { 1180 {
1183 1181
1184 /* Unload the previously loaded binding. */ 1182 /* Unload the previously loaded binding. */
@@ -1189,16 +1187,8 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1189 { 1187 {
1190 Lisp_Object var; 1188 Lisp_Object var;
1191 XSETSYMBOL (var, symbol); 1189 XSETSYMBOL (var, symbol);
1192 if (blv->frame_local) 1190 tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
1193 { 1191 set_blv_where (blv, Fcurrent_buffer ());
1194 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1195 set_blv_where (blv, selected_frame);
1196 }
1197 else
1198 {
1199 tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
1200 set_blv_where (blv, Fcurrent_buffer ());
1201 }
1202 } 1192 }
1203 if (!(blv->found = !NILP (tem1))) 1193 if (!(blv->found = !NILP (tem1)))
1204 tem1 = blv->defcell; 1194 tem1 = blv->defcell;
@@ -1266,7 +1256,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
1266} 1256}
1267 1257
1268/* Store the value NEWVAL into SYMBOL. 1258/* Store the value NEWVAL into SYMBOL.
1269 If buffer/frame-locality is an issue, WHERE specifies which context to use. 1259 If buffer-locality is an issue, WHERE specifies which context to use.
1270 (nil stands for the current buffer/frame). 1260 (nil stands for the current buffer/frame).
1271 1261
1272 If BINDFLAG is SET_INTERNAL_SET, then if this symbol is supposed to 1262 If BINDFLAG is SET_INTERNAL_SET, then if this symbol is supposed to
@@ -1322,15 +1312,10 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
1322 { 1312 {
1323 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 1313 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1324 if (NILP (where)) 1314 if (NILP (where))
1325 { 1315 XSETBUFFER (where, current_buffer);
1326 if (blv->frame_local) 1316
1327 where = selected_frame;
1328 else
1329 XSETBUFFER (where, current_buffer);
1330 }
1331 /* If the current buffer is not the buffer whose binding is 1317 /* If the current buffer is not the buffer whose binding is
1332 loaded, or if there may be frame-local bindings and the frame 1318 loaded, or if it's a Lisp_Buffer_Local_Value and
1333 isn't the right one, or if it's a Lisp_Buffer_Local_Value and
1334 the default binding is loaded, the loaded binding may be the 1319 the default binding is loaded, the loaded binding may be the
1335 wrong one. */ 1320 wrong one. */
1336 if (!EQ (blv->where, where) 1321 if (!EQ (blv->where, where)
@@ -1347,9 +1332,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
1347 /* Find the new binding. */ 1332 /* Find the new binding. */
1348 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1333 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
1349 tem1 = assq_no_quit (symbol, 1334 tem1 = assq_no_quit (symbol,
1350 (blv->frame_local 1335 BVAR (XBUFFER (where), local_var_alist));
1351 ? XFRAME (where)->param_alist
1352 : BVAR (XBUFFER (where), local_var_alist)));
1353 set_blv_where (blv, where); 1336 set_blv_where (blv, where);
1354 blv->found = 1; 1337 blv->found = 1;
1355 1338
@@ -1376,9 +1359,6 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
1376 and load that binding. */ 1359 and load that binding. */
1377 else 1360 else
1378 { 1361 {
1379 /* local_if_set is only supported for buffer-local
1380 bindings, not for frame-local bindings. */
1381 eassert (!blv->frame_local);
1382 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1362 tem1 = Fcons (symbol, XCDR (blv->defcell));
1383 bset_local_var_alist 1363 bset_local_var_alist
1384 (XBUFFER (where), 1364 (XBUFFER (where),
@@ -1442,9 +1422,6 @@ set_symbol_trapped_write (Lisp_Object symbol, enum symbol_trapped_write trap)
1442 struct Lisp_Symbol* sym = XSYMBOL (symbol); 1422 struct Lisp_Symbol* sym = XSYMBOL (symbol);
1443 if (sym->trapped_write == SYMBOL_NOWRITE) 1423 if (sym->trapped_write == SYMBOL_NOWRITE)
1444 xsignal1 (Qtrapping_constant, symbol); 1424 xsignal1 (Qtrapping_constant, symbol);
1445 else if (sym->redirect == SYMBOL_LOCALIZED
1446 && SYMBOL_BLV (sym)->frame_local)
1447 xsignal1 (Qtrapping_frame_local, symbol);
1448 sym->trapped_write = trap; 1425 sym->trapped_write = trap;
1449} 1426}
1450 1427
@@ -1784,7 +1761,6 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded,
1784 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); 1761 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1785 blv->fwd = forwarded ? valcontents.fwd : NULL; 1762 blv->fwd = forwarded ? valcontents.fwd : NULL;
1786 set_blv_where (blv, Qnil); 1763 set_blv_where (blv, Qnil);
1787 blv->frame_local = 0;
1788 blv->local_if_set = 0; 1764 blv->local_if_set = 0;
1789 set_blv_defcell (blv, tem); 1765 set_blv_defcell (blv, tem);
1790 set_blv_valcell (blv, tem); 1766 set_blv_valcell (blv, tem);
@@ -1831,9 +1807,6 @@ The function `default-value' gets the default value and `set-default' sets it.
1831 break; 1807 break;
1832 case SYMBOL_LOCALIZED: 1808 case SYMBOL_LOCALIZED:
1833 blv = SYMBOL_BLV (sym); 1809 blv = SYMBOL_BLV (sym);
1834 if (blv->frame_local)
1835 error ("Symbol %s may not be buffer-local",
1836 SDATA (SYMBOL_NAME (variable)));
1837 break; 1810 break;
1838 case SYMBOL_FORWARDED: 1811 case SYMBOL_FORWARDED:
1839 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); 1812 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
@@ -1908,9 +1881,6 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1908 forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break; 1881 forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break;
1909 case SYMBOL_LOCALIZED: 1882 case SYMBOL_LOCALIZED:
1910 blv = SYMBOL_BLV (sym); 1883 blv = SYMBOL_BLV (sym);
1911 if (blv->frame_local)
1912 error ("Symbol %s may not be buffer-local",
1913 SDATA (SYMBOL_NAME (variable)));
1914 break; 1884 break;
1915 case SYMBOL_FORWARDED: 1885 case SYMBOL_FORWARDED:
1916 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym); 1886 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
@@ -2027,8 +1997,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
2027 } 1997 }
2028 case SYMBOL_LOCALIZED: 1998 case SYMBOL_LOCALIZED:
2029 blv = SYMBOL_BLV (sym); 1999 blv = SYMBOL_BLV (sym);
2030 if (blv->frame_local)
2031 return variable;
2032 break; 2000 break;
2033 default: emacs_abort (); 2001 default: emacs_abort ();
2034 } 2002 }
@@ -2062,81 +2030,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
2062 2030
2063/* Lisp functions for creating and removing buffer-local variables. */ 2031/* Lisp functions for creating and removing buffer-local variables. */
2064 2032
2065/* Obsolete since 22.2. NB adjust doc of modify-frame-parameters
2066 when/if this is removed. */
2067
2068DEFUN ("make-variable-frame-local", Fmake_variable_frame_local, Smake_variable_frame_local,
2069 1, 1, "vMake Variable Frame Local: ",
2070 doc: /* Enable VARIABLE to have frame-local bindings.
2071This does not create any frame-local bindings for VARIABLE,
2072it just makes them possible.
2073
2074A frame-local binding is actually a frame parameter value.
2075If a frame F has a value for the frame parameter named VARIABLE,
2076that also acts as a frame-local binding for VARIABLE in F--
2077provided this function has been called to enable VARIABLE
2078to have frame-local bindings at all.
2079
2080The only way to create a frame-local binding for VARIABLE in a frame
2081is to set the VARIABLE frame parameter of that frame. See
2082`modify-frame-parameters' for how to set frame parameters.
2083
2084Note that since Emacs 23.1, variables cannot be both buffer-local and
2085frame-local any more (buffer-local bindings used to take precedence over
2086frame-local bindings). */)
2087 (Lisp_Object variable)
2088{
2089 bool forwarded;
2090 union Lisp_Val_Fwd valcontents;
2091 struct Lisp_Symbol *sym;
2092 struct Lisp_Buffer_Local_Value *blv = NULL;
2093
2094 CHECK_SYMBOL (variable);
2095 sym = XSYMBOL (variable);
2096
2097 start:
2098 switch (sym->redirect)
2099 {
2100 case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
2101 case SYMBOL_PLAINVAL:
2102 forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
2103 if (EQ (valcontents.value, Qunbound))
2104 valcontents.value = Qnil;
2105 break;
2106 case SYMBOL_LOCALIZED:
2107 if (SYMBOL_BLV (sym)->frame_local)
2108 return variable;
2109 else
2110 error ("Symbol %s may not be frame-local",
2111 SDATA (SYMBOL_NAME (variable)));
2112 case SYMBOL_FORWARDED:
2113 forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
2114 if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd))
2115 error ("Symbol %s may not be frame-local",
2116 SDATA (SYMBOL_NAME (variable)));
2117 break;
2118 default: emacs_abort ();
2119 }
2120
2121 if (SYMBOL_TRAPPED_WRITE_P (variable))
2122 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
2123
2124 blv = make_blv (sym, forwarded, valcontents);
2125 blv->frame_local = 1;
2126 sym->redirect = SYMBOL_LOCALIZED;
2127 SET_SYMBOL_BLV (sym, blv);
2128 {
2129 Lisp_Object symbol;
2130 XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
2131 if (let_shadows_global_binding_p (symbol))
2132 {
2133 AUTO_STRING (format, "Making %s frame-local while let-bound!");
2134 CALLN (Fmessage, format, SYMBOL_NAME (variable));
2135 }
2136 }
2137 return variable;
2138}
2139
2140DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p, 2033DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p,
2141 1, 2, 0, 2034 1, 2, 0,
2142 doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER. 2035 doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER.
@@ -2168,10 +2061,7 @@ BUFFER defaults to the current buffer. */)
2168 { 2061 {
2169 elt = XCAR (tail); 2062 elt = XCAR (tail);
2170 if (EQ (variable, XCAR (elt))) 2063 if (EQ (variable, XCAR (elt)))
2171 { 2064 return Qt;
2172 eassert (!blv->frame_local);
2173 return Qt;
2174 }
2175 } 2065 }
2176 return Qnil; 2066 return Qnil;
2177 } 2067 }
@@ -2230,7 +2120,6 @@ DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locu
2230 1, 1, 0, 2120 1, 1, 0,
2231 doc: /* Return a value indicating where VARIABLE's current binding comes from. 2121 doc: /* Return a value indicating where VARIABLE's current binding comes from.
2232If the current binding is buffer-local, the value is the current buffer. 2122If the current binding is buffer-local, the value is the current buffer.
2233If the current binding is frame-local, the value is the selected frame.
2234If the current binding is global (the default), the value is nil. */) 2123If the current binding is global (the default), the value is nil. */)
2235 (register Lisp_Object variable) 2124 (register Lisp_Object variable)
2236{ 2125{
@@ -3664,7 +3553,6 @@ syms_of_data (void)
3664 DEFSYM (Qvoid_variable, "void-variable"); 3553 DEFSYM (Qvoid_variable, "void-variable");
3665 DEFSYM (Qsetting_constant, "setting-constant"); 3554 DEFSYM (Qsetting_constant, "setting-constant");
3666 DEFSYM (Qtrapping_constant, "trapping-constant"); 3555 DEFSYM (Qtrapping_constant, "trapping-constant");
3667 DEFSYM (Qtrapping_frame_local, "trapping-frame-local");
3668 DEFSYM (Qinvalid_read_syntax, "invalid-read-syntax"); 3556 DEFSYM (Qinvalid_read_syntax, "invalid-read-syntax");
3669 3557
3670 DEFSYM (Qinvalid_function, "invalid-function"); 3558 DEFSYM (Qinvalid_function, "invalid-function");
@@ -3745,8 +3633,6 @@ syms_of_data (void)
3745 "Attempt to set a constant symbol"); 3633 "Attempt to set a constant symbol");
3746 PUT_ERROR (Qtrapping_constant, error_tail, 3634 PUT_ERROR (Qtrapping_constant, error_tail,
3747 "Attempt to trap writes to a constant symbol"); 3635 "Attempt to trap writes to a constant symbol");
3748 PUT_ERROR (Qtrapping_frame_local, error_tail,
3749 "Attempt to trap writes to a frame local variable");
3750 PUT_ERROR (Qinvalid_read_syntax, error_tail, "Invalid read syntax"); 3636 PUT_ERROR (Qinvalid_read_syntax, error_tail, "Invalid read syntax");
3751 PUT_ERROR (Qinvalid_function, error_tail, "Invalid function"); 3637 PUT_ERROR (Qinvalid_function, error_tail, "Invalid function");
3752 PUT_ERROR (Qwrong_number_of_arguments, error_tail, 3638 PUT_ERROR (Qwrong_number_of_arguments, error_tail,
@@ -3876,7 +3762,6 @@ syms_of_data (void)
3876 defsubr (&Smake_variable_buffer_local); 3762 defsubr (&Smake_variable_buffer_local);
3877 defsubr (&Smake_local_variable); 3763 defsubr (&Smake_local_variable);
3878 defsubr (&Skill_local_variable); 3764 defsubr (&Skill_local_variable);
3879 defsubr (&Smake_variable_frame_local);
3880 defsubr (&Slocal_variable_p); 3765 defsubr (&Slocal_variable_p);
3881 defsubr (&Slocal_variable_if_set_p); 3766 defsubr (&Slocal_variable_if_set_p);
3882 defsubr (&Svariable_binding_locus); 3767 defsubr (&Svariable_binding_locus);