aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/data.c b/src/data.c
index 06308c62c49..a7fab1ef58a 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1188,7 +1188,7 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
1188 1188
1189 /* Indicate that the global binding is set up now. */ 1189 /* Indicate that the global binding is set up now. */
1190 set_blv_where (blv, Qnil); 1190 set_blv_where (blv, Qnil);
1191 set_blv_found (blv, 0); 1191 set_blv_found (blv, false);
1192} 1192}
1193 1193
1194/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 1194/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1257,7 +1257,6 @@ find_symbol_value (Lisp_Object symbol)
1257 swap_in_symval_forwarding (sym, blv); 1257 swap_in_symval_forwarding (sym, blv);
1258 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv); 1258 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv);
1259 } 1259 }
1260 /* FALLTHROUGH */
1261 case SYMBOL_FORWARDED: 1260 case SYMBOL_FORWARDED:
1262 return do_symval_forwarding (SYMBOL_FWD (sym)); 1261 return do_symval_forwarding (SYMBOL_FWD (sym));
1263 default: emacs_abort (); 1262 default: emacs_abort ();
@@ -1366,7 +1365,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
1366 tem1 = assq_no_quit (symbol, 1365 tem1 = assq_no_quit (symbol,
1367 BVAR (XBUFFER (where), local_var_alist)); 1366 BVAR (XBUFFER (where), local_var_alist));
1368 set_blv_where (blv, where); 1367 set_blv_where (blv, where);
1369 blv->found = 1; 1368 blv->found = true;
1370 1369
1371 if (NILP (tem1)) 1370 if (NILP (tem1))
1372 { 1371 {
@@ -1381,7 +1380,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
1381 if (bindflag || !blv->local_if_set 1380 if (bindflag || !blv->local_if_set
1382 || let_shadows_buffer_binding_p (sym)) 1381 || let_shadows_buffer_binding_p (sym))
1383 { 1382 {
1384 blv->found = 0; 1383 blv->found = false;
1385 tem1 = blv->defcell; 1384 tem1 = blv->defcell;
1386 } 1385 }
1387 /* If it's a local_if_set, being set not bound, 1386 /* If it's a local_if_set, being set not bound,
@@ -1796,7 +1795,7 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded,
1796 blv->local_if_set = 0; 1795 blv->local_if_set = 0;
1797 set_blv_defcell (blv, tem); 1796 set_blv_defcell (blv, tem);
1798 set_blv_valcell (blv, tem); 1797 set_blv_valcell (blv, tem);
1799 set_blv_found (blv, 0); 1798 set_blv_found (blv, false);
1800 return blv; 1799 return blv;
1801} 1800}
1802 1801
@@ -1945,30 +1944,17 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1945 CALLN (Fmessage, format, SYMBOL_NAME (variable)); 1944 CALLN (Fmessage, format, SYMBOL_NAME (variable));
1946 } 1945 }
1947 1946
1948 /* Swap out any local binding for some other buffer, and make 1947 if (BUFFERP (blv->where) && current_buffer == XBUFFER (blv->where))
1949 sure the current value is permanently recorded, if it's the 1948 /* Make sure the current value is permanently recorded, if it's the
1950 default value. */ 1949 default value. */
1951 find_symbol_value (variable); 1950 swap_in_global_binding (sym);
1952 1951
1953 bset_local_var_alist 1952 bset_local_var_alist
1954 (current_buffer, 1953 (current_buffer,
1955 Fcons (Fcons (variable, XCDR (blv->defcell)), 1954 Fcons (Fcons (variable, XCDR (blv->defcell)),
1956 BVAR (current_buffer, local_var_alist))); 1955 BVAR (current_buffer, local_var_alist)));
1957
1958 /* Make sure symbol does not think it is set up for this buffer;
1959 force it to look once again for this buffer's value. */
1960 if (current_buffer == XBUFFER (blv->where))
1961 set_blv_where (blv, Qnil);
1962 set_blv_found (blv, 0);
1963 } 1956 }
1964 1957
1965 /* If the symbol forwards into a C variable, then load the binding
1966 for this buffer now. If C code modifies the variable before we
1967 load the binding in, then that new value will clobber the default
1968 binding the next time we unload it. */
1969 if (blv->fwd)
1970 swap_in_symval_forwarding (sym, blv);
1971
1972 return variable; 1958 return variable;
1973} 1959}
1974 1960
@@ -2030,11 +2016,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
2030 { 2016 {
2031 Lisp_Object buf; XSETBUFFER (buf, current_buffer); 2017 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
2032 if (EQ (buf, blv->where)) 2018 if (EQ (buf, blv->where))
2033 { 2019 swap_in_global_binding (sym);
2034 set_blv_where (blv, Qnil);
2035 blv->found = 0;
2036 find_symbol_value (variable);
2037 }
2038 } 2020 }
2039 2021
2040 return variable; 2022 return variable;