[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: values of buffer-local variables lost after dired-do-rename
From: |
Gareth Rees |
Subject: |
Re: values of buffer-local variables lost after dired-do-rename |
Date: |
28 Nov 2002 10:50:24 -0800 |
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> wrote:
> Suppose I've visited a file in emacs, then I rename that file by means
> of dired-do-rename. Afterwards all the values of buffer-local
> variables are replaced by the corresponding global values. Why don't
> they keep their buffer-local values (at least for file-local
> variables)?
Because when you change the file name Emacs changes the major mode to
match the the new file name. And changing the major mode kills all the
local variables.
You can stop Emacs changing the major mode when the file name changes by
setting `change-major-mode-with-file-name' to nil.
Or if you have a particular local variable that you want to preserve,
you can give it the `permanent-local' property so that
`kill-all-local-variables'' will ignore it, for example:
(put 'fill-column 'permanent-local t)
--
Gareth Rees