aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-10-06 12:53:07 +0200
committerLars Ingebrigtsen2021-10-06 12:55:21 +0200
commitc0f7396588080ac48b72b905880d3f488e5becb3 (patch)
tree7f59d19cf3730746312813bdc86559c5504dc1b9 /src/buffer.c
parentff31741b85593635e96cf67fea8fbc015cbbb582 (diff)
downloademacs-c0f7396588080ac48b72b905880d3f488e5becb3.tar.gz
emacs-c0f7396588080ac48b72b905880d3f488e5becb3.zip
Add an optional parameter to kill-all-local-variables
* doc/lispref/variables.texi (Creating Buffer-Local): Document it (bug#30204). * src/buffer.c (Fkill_all_local_variables): Allow killing permanent local variables, too. * src/print.c (temp_output_buffer_setup): * src/minibuf.c (set_minibuffer_mode): Adjust callers.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4eb7ab6d6ba..c5b2736ae3a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2805,7 +2805,7 @@ current buffer is cleared. */)
2805} 2805}
2806 2806
2807DEFUN ("kill-all-local-variables", Fkill_all_local_variables, 2807DEFUN ("kill-all-local-variables", Fkill_all_local_variables,
2808 Skill_all_local_variables, 0, 0, 0, 2808 Skill_all_local_variables, 0, 1, 0,
2809 doc: /* Switch to Fundamental mode by killing current buffer's local variables. 2809 doc: /* Switch to Fundamental mode by killing current buffer's local variables.
2810Most local variable bindings are eliminated so that the default values 2810Most local variable bindings are eliminated so that the default values
2811become effective once more. Also, the syntax table is set from 2811become effective once more. Also, the syntax table is set from
@@ -2816,18 +2816,20 @@ This function also forces redisplay of the mode line.
2816Every function to select a new major mode starts by 2816Every function to select a new major mode starts by
2817calling this function. 2817calling this function.
2818 2818
2819As a special exception, local variables whose names have 2819As a special exception, local variables whose names have a non-nil
2820a non-nil `permanent-local' property are not eliminated by this function. 2820`permanent-local' property are not eliminated by this function. If
2821the optional KILL-PERMANENT argument is non-nil, clear out these local
2822variables, too.
2821 2823
2822The first thing this function does is run 2824The first thing this function does is run
2823the normal hook `change-major-mode-hook'. */) 2825the normal hook `change-major-mode-hook'. */)
2824 (void) 2826 (Lisp_Object kill_permanent)
2825{ 2827{
2826 run_hook (Qchange_major_mode_hook); 2828 run_hook (Qchange_major_mode_hook);
2827 2829
2828 /* Actually eliminate all local bindings of this buffer. */ 2830 /* Actually eliminate all local bindings of this buffer. */
2829 2831
2830 reset_buffer_local_variables (current_buffer, 0); 2832 reset_buffer_local_variables (current_buffer, !NILP (kill_permanent));
2831 2833
2832 /* Force mode-line redisplay. Useful here because all major mode 2834 /* Force mode-line redisplay. Useful here because all major mode
2833 commands call this function. */ 2835 commands call this function. */