Matthieu Moy <[EMAIL PROTECTED]> writes: > Hi ! > > What's the use of the > > (kill-all-local-variables) > > at the beginning of tla-inventory-mode? > > This may be usefull for a mode like a programming language mode that > can be called to replace a previously running mode in the same buffer, > but for tla specific buffers mode, I think it's useless because the > function is always called in a newly created buffer. > > There used to be a lot of such function call that I had to remove > because it broke some other code (setting local variables before > calling the *-mode function). > > So, is this function really usefull?
I looked at the documentation of kill-all-local-variables: kill-all-local-variables is a built-in function. (kill-all-local-variables) 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. The first thing this function does is run the normal hook `change-major-mode-hook'. tla-inventory-mode is a major-mode, so I call kill-all-local-variables in this mode. I am not sure, what will happen if we drop that call. Stefan.
