Function: kill-all-local-variables
kill-all-local-variables is a function defined in buffer.c.
Signature
(kill-all-local-variables &optional KILL-PERMANENT)
Documentation
Switch to Fundamental mode by killing current buffer's local variables.
Most local variable bindings are eliminated so that the default values
become effective once more. Also, the syntax table is set from
standard-syntax-table, the local keymap is set to nil,
and the abbrev table from fundamental-mode-abbrev-table.
This function also forces redisplay of the mode line.
Every function to select a new major mode starts by calling this function.
As a special exception, local variables whose names have a non-nil
permanent-local property are not eliminated by this function. If
the optional KILL-PERMANENT argument is non-nil, clear out these local
variables, too.
If KILL-PERMANENT is the symbol permanent-local, kill local variables
and ignore variable watchers. If KILL-PERMANENT is the symbol reset,
ignore variable watchers and reset the buffer as if newly created. Use
these with caution. For example, reset sets buffer variables such as
default-directory to nil and may result in unexpected behavior.
The first thing this function does is run
the normal hook change-major-mode-hook.
Probably introduced at or before Emacs version 19.23.
Source Code
// Defined in /usr/src/emacs/src/buffer.c
{
run_hook (Qchange_major_mode_hook);
int permanent_too = 0;
if (!NILP (kill_permanent))
{
permanent_too = 2;
if (EQ (kill_permanent, Qpermanent_local))
permanent_too = 1;
else if (EQ (kill_permanent, Qreset))
{
permanent_too = 1;
reset_buffer (current_buffer);
}
}
/* Actually eliminate all local bindings of this buffer. */
reset_buffer_local_variables (current_buffer, permanent_too);
/* Force mode-line redisplay. Useful here because all major mode
commands call this function. */
bset_update_mode_line (current_buffer);
return Qnil;
}