views:

237

answers:

4

How can I load changes from .emacs without rebooting Emacs?

+4  A: 

The following should do it...

M-x load-file
Pace
+14  A: 

If you've got your .emacs file open in the currently active buffer:

M-x eval-buffer
Dominic Rodger
One thing to be aware of here is that doing this *may* not leave you in a state identical to a restart approach. (Contrived example: if you had a "toggle" affect in your .emacs).
luapyad
@luapypad - excellent point.
Dominic Rodger
+8  A: 

Others already answered your question as stated, but I find that I usually want to execute the lines that I just wrote. for that, CtrlAltx at the end of the lisp works just fine.

Bahbar
See also `eval-lastsexp`, at `C-x C-e`
nullptr
A: 

I suggest that you don't do this, initially. Instead, start a new emacs session and test whatever changes you made to see if they work correctly. The reason to do it this way is to avoid leaving you in a state where you have an inoperable .emacs file, which fails to load or fails to load cleanly. If you do all of your editing in the original session, and all of your testing in a new session, you'll always have something reliable to comment out offending code.

When you are finally happy with your changes, then go ahead and use one of the other answers to re-load. My personal preference is to just the section you've added/changed, and to do that just highlight the region of added/changed code and call M-x eval-region. Doing that minimizes the code that's evaluated, minimizing any unintentional side-effects, as luapyad points out.

Joe Casadonte