How to reload an emacs major mode?

yuk picture yuk · Dec 5, 2010 · Viewed 8k times · Source

I have a buffer in some major-mode, and in another buffer the mode file itself (*.el). After I edit the *.el file I want to see the changes reflected in the first buffer, without restarting emacs. I tried to run the -mode function but it didn't change the buffer. Thanks

Answer

Gareth Rees picture Gareth Rees · Dec 5, 2010

If your mode provides a feature (as it should!) using (provide 'foo-mode) then you can

M-x unload-feature RET foo-mode RET

and then load the mode again as normal (using foo-mode if you have an appropriate autoload, or using load-library or load-file otherwise).