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, 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:
.emacs
without having to fully restart Emacs?.emacs
file from scratch) asking it to re-open all buffers that I have open?You can use the command load-file ( M-x load-file , then press return twice to accept the default filename, which is the current file being edited). You can also just move the point to the end of any sexp and press C-x C-e to execute just that sexp.
There is no way to restart an Emacs session once you have killed it. You can, however, arrange for Emacs to record certain session information, such as which files are visited, when you kill it, so that the next time you restart Emacs it will try to visit the same files and so on.
Press M-x and select doom/reload to apply the changes; If changes doesn't apply, close and re-open the Emacs.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With