Though I use tiling window manager StumpWM and it’s very easy to switch to running Firefox with keyboard shortcut and make refresh, it’s even easier not to leave focus from Emacs window and just send command to Firefox to refresh itself.
For that I use:
- MozRepl firefox plugin to allow connect to Firefox’s REPL. After installation in Tools -> MozRepl menu I chose ‘Activate on startup’ for convenience
- MozRepl Emacs integration (If you use nXhtml package in Emacs you already have that integration and can skip this part)
Command to refresh Firefox is BrowserReload();
Final touch is small anonymous function to send that command to mozrepl, keybinding to C-x p and we’re all set:
(global-set-key (kbd "C-x p") (lambda () (interactive) (comint-send-string (inferior-moz-process) "BrowserReload();")))
Now anytime just press C-x p and refresh command will be sent to Firefox starting along the way mozrepl session in your Emacs if it’s not been already started.