Function: kill-local-variable
kill-local-variable is an interactive function defined in data.c.
Signature
(kill-local-variable VARIABLE)
Documentation
Make VARIABLE no longer have a separate value in the current buffer.
From now on the default value will apply in this buffer. Return VARIABLE.
Key Bindings
Source Code
// Defined in /usr/src/emacs/src/data.c
{
register Lisp_Object tem;
struct Lisp_Buffer_Local_Value *blv;
struct Lisp_Symbol *sym;
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
start:
switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return variable;
case SYMBOL_FORWARDED:
{
lispfwd valcontents = SYMBOL_FWD (sym);
if (BUFFER_OBJFWDP (valcontents))
{
int offset = XBUFFER_OBJFWD (valcontents)->offset;
int idx = PER_BUFFER_IDX (offset);
if (idx > 0)
{
SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
set_per_buffer_value (current_buffer, offset,
per_buffer_default (offset));
}
}
return variable;
}
case SYMBOL_LOCALIZED:
blv = SYMBOL_BLV (sym);
break;
default: emacs_abort ();
}
if (sym->u.s.trapped_write == SYMBOL_TRAPPED_WRITE)
notify_variable_watchers (variable, Qnil, Qmakunbound, Fcurrent_buffer ());
/* Get rid of this buffer's alist element, if any. */
XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
if (!NILP (tem))
bset_local_var_alist
(current_buffer,
Fdelq (tem, BVAR (current_buffer, local_var_alist)));
/* If the symbol is set up with the current buffer's binding
loaded, recompute its value. We have to do it now, or else
forwarded objects won't work right. */
{
Lisp_Object buf; XSETBUFFER (buf, current_buffer);
if (EQ (buf, blv->where))
swap_in_global_binding (sym);
}
return variable;
}