In my experience xhtml-mode's browse-url-of-buffer command uses different browsers depending, I guess, on the different desktop environments (or on their absence sometimes).

My question, how can I tell Emacs to use always the same browser, desktop environment notwithstanding?

Bonus points :-) for the details of the Emacs-environment interaction that leads to browse-url-of-buffer calling a specific browser...


1 Answer 1


Take a look at browse-url-browser-function; you can use it to specify various functions, including browse-url-firefox, browse-url-chromium, browse-url-w3 & many more — you can even write your own, if you feel like it.

You can find this sort of thing out for yourself by running e.g. C-h f browse-url-of-buffer, and then clicking on the browse-url.el link, which will take you to the definition of browse-url-browser-function; you can see at the end that it calls (browse-url-of-file file-name); if you type M-. on browse-url-of-file you'll be taken to its definition and see from its docstring that it calls browse-url; its docstring discusses browse-url-browser-function and more.

You can also do C-h a browse-url to see stuff apropos to browsing URLs; there's a ton of stuff there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.