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.

The first thing this function does is run the normal hook change-major-mode-hook.

View in manual

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);

  /* Actually eliminate all local bindings of this buffer.  */

  reset_buffer_local_variables (current_buffer, !NILP (kill_permanent));

  /* Force mode-line redisplay.  Useful here because all major mode
     commands call this function.  */
  bset_update_mode_line (current_buffer);

  return Qnil;
}