How to reload your .emacs file while emacs is running
- M-x load-file ENTER
- ~/.emacs
- ENTER
Related posts
- Magit in Spacemacs (evil-magit) notes — posted 2018-11-02
- Switching from Emacs to Vim (actually Spacemacs) — posted 2015-12-31
- Colorized, interactive "git blame" in Emacs: vc-annotate — posted 2011-05-28
- My Emacs Python environment — posted 2010-05-10
- Emacs espresso-mode for jQuery — posted 2010-03-10
- Notes on C++ development with Emacs on Ubuntu Linux — posted 2009-07-08
Comments
This does not reset any indentations, specified in the .emacs file, so it is not the full equivalent of a start up.
For example: ;; --- Automatic indentation must use only 1 unit (tab) (add-hook 'c-special-indent-hook '( lambda() (set-variable 'c-basic-offset '2)))
Rusmor: yes, I often have to completely restart emacs instead of using this.
The suggested strategy is not guaranteed to give you a totally revised configuration. It will parse your new configuration file and it will reload modified variable and function definitions. But it will not remove previously loaded definitions. For that to happen, you need to restart Emacs afresh.
It may not work for all your needs, but it's quite useful all the same.
I'll use it with M-x reload-dotemacs-file by adding to my .emacs file:
(defun reload-dotemacs-file ()
"reload your .emacs file without restarting Emacs"
(interactive)
(load-file "~/.emacs") )