Reset definitions and reload .emacs without closing, or restart Emacs and re-open buffers
As far as I understand, the following sequence of commands
M-x load-file ENTER
~/.emacs
ENTER
would re-load my .emacs
file. However, from what I have read on other forums, they are not guaranteed to give me a totally revised configuration, 开发者_JS百科i.e. they would force Emacs to parse the new configuration file and reload modified variable and function definitions, but they would not remove previously loaded definitions.
With this, my questions are:
- Is it possible to clear ups Emacs's definitions in memory and re-load
.emacs
without having to fully restart Emacs? - If the above is not possible, is there a way to restart Emacs (so that I parses my
.emacs
file from scratch) asking it to re-open all buffers that I have open?
Undoing everything that might have been done in your .emacs
is impossible.
You can save and restore an emacs session with desktop
. Quit with M-x desktop-save RET C-x C-c
and then restore with emacs -f desktop-read
.
See (info "(emacs) Saving Emacs Sessions")
for more information. (You can also customize
desktop-save-mode
so that this behavior is the default.)
This question is a duplicate, but as it has an accepted answer I'll repeat my comments about the Desktop library which is that it stores a certain amount of state (modes and local variables) with each buffer that it saves, and it then restores that same state when it reloads those files.
In your case, of course, this is exactly what you don't want to happen.
See Reload .emacs for all active buffers for a simple way to revert (reload) all the buffers.
Combining the two approaches would let you restart Emacs, with Desktop restoring the files, at which point you could revert all the files.
精彩评论