How can I get Emacs to reload all my definitions that I have updated in .emacs
without restarting Emacs?
If you've got your .emacs file open in the currently active buffer:
M-x eval-buffer
I'm currently on Ubuntu 15.04; I like to define a key for this.
[M-insert] translates to alt-insert on my keyboard.
Put this in your .emacs file:
(global-set-key [M-insert] '(lambda() (interactive) (load-file "~/.emacs")))
Very strange that the very convenient
M-x eval-buffer
is not mentioned here.
It immediately evaluates all code in the buffer, its the quickest method, if your .emacs
is idempotent.
Keyboard shortcut:
(defun reload-init-file ()
(interactive)
(load-file user-init-file))
(global-set-key (kbd "C-c C-l") 'reload-init-file) ; Reload .emacs file
If you happen to have a shell opened inside Emacs, you can also do:
. ~/.emacs
May save a few key strokes.
M-: (load user-init-file)
Eval:
prompt (including the parentheses)~/.emacs
value (pointing to the configuration file path) by defaultM-:
> M-x