Adding a simple save and reload in emacs

I'm starting to like emacs. It's really simple to extend it with new commands.

One simple use case is to save a file and reload the browser. It is very useful when editing a web page or some source for a web application. I've done this for Chrome but it will for sure be easy to adapt this solution for emacs.

First of all install chrome-cli. This allows us to control chrome from the command line. Then, the rest is just piece of cake. In your .emacs file you can add the following code:

This will add a save_and_reload command that you can try with M-x save-and-reload.

I also added a keybinding with the following

So I can save and reload with C-x C-r. Awesome.

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *