97

How do I load the edited .emacs file without restarting Emacs?

9 Answers 9

137

M-x eval-buffer

2
  • 17
    This works only if you were editing the ".emacs" file itself. Commented Sep 25, 2014 at 12:46
  • 1
    This does not seem to work when changing the font size. Commented Nov 12, 2018 at 20:58
27

I usually use M-x load-file. But be aware that some initialization is only done the first time through. Things like libraries that set their defaults when loaded, but don't get reloaded the second time through. Its always a good idea to start up emacs from scratch as a final check that everything works ok.

12

In the *scratch* buffer, type:

(load-file user-init-file)

Then press C-x C-e to evaluate the expression.

7

M-x load-file and then choose the .emacs file should also work

7

M-x load-file ~/.emacs

eval-buffer when the .emacs file is opened

eval-region when you want apply selected lines

C-x C-e evaluates the preceding expression

1
  • C-x C-e evaluates the preceding expression, which may span multiple lines.
    – phils
    Commented Aug 26, 2012 at 0:57
6
M-x load-file ENTER
~/.emacs
ENTER

(source)

5

Open the .emacs file, select its contents and hit C-x,C-e

2

you can use C-x C-e which will evaluate an s-expression. Make sure the cursor is at the last parenthesis of the elisp code.

2

I use and recommend restart-emacs package on melpa

Not the answer you're looking for? Browse other questions tagged or ask your own question.