diff options
| author | Lars Ingebrigtsen | 2021-10-06 12:53:07 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-10-06 12:55:21 +0200 |
| commit | c0f7396588080ac48b72b905880d3f488e5becb3 (patch) | |
| tree | 7f59d19cf3730746312813bdc86559c5504dc1b9 /src/buffer.c | |
| parent | ff31741b85593635e96cf67fea8fbc015cbbb582 (diff) | |
| download | emacs-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.c | 12 |
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 | ||
| 2807 | DEFUN ("kill-all-local-variables", Fkill_all_local_variables, | 2807 | DEFUN ("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. |
| 2810 | Most local variable bindings are eliminated so that the default values | 2810 | Most local variable bindings are eliminated so that the default values |
| 2811 | become effective once more. Also, the syntax table is set from | 2811 | become effective once more. Also, the syntax table is set from |
| @@ -2816,18 +2816,20 @@ This function also forces redisplay of the mode line. | |||
| 2816 | Every function to select a new major mode starts by | 2816 | Every function to select a new major mode starts by |
| 2817 | calling this function. | 2817 | calling this function. |
| 2818 | 2818 | ||
| 2819 | As a special exception, local variables whose names have | 2819 | As a special exception, local variables whose names have a non-nil |
| 2820 | a non-nil `permanent-local' property are not eliminated by this function. | 2820 | `permanent-local' property are not eliminated by this function. If |
| 2821 | the optional KILL-PERMANENT argument is non-nil, clear out these local | ||
| 2822 | variables, too. | ||
| 2821 | 2823 | ||
| 2822 | The first thing this function does is run | 2824 | The first thing this function does is run |
| 2823 | the normal hook `change-major-mode-hook'. */) | 2825 | the 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. */ |