Google Chrome is set as the default browser. However, it opens links in Firefox, which is undesired.
How can I make Org-mode to open links in Google Chrome?
Google Chrome is set as the default browser. However, it opens links in Firefox, which is undesired.
How can I make Org-mode to open links in Google Chrome?
Emacs 23.2 doesn't directly support Google Chrome, but it does support a "generic" browser, and something like this should work:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "chromium-browser")
You don't mention your OS, but if it's Windows or Mac, you can try:
(setq browse-url-browser-function 'browse-url-default-windows-browser)
(setq browse-url-browser-function 'browse-url-default-macosx-browser)
And, if that doesn't work, there are other folks who have implemented 'browse-url-chrome
. Google turned up the following link:
As Trey suggests, you can set it to a generic browser, but instead of "chromium-browser" use "google-chrome", like this:
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome")
That worked for me with Emacs 23.2 and Chrome 12.
I have a similar problem (although the other way around: I wanted Emacs to open Firefox, but it opened Chromium).
I'm using Ubuntu 12.04 (Precise Pangolin), but already had the problem with UbuntuĀ 11.10 (Oneiric Ocelot). The solution below applies to Linux, maybe macOS (?), and probably not Windows.
Setting browse-url-generic-program
as suggested in other answers didn't work for me. Note also that my default browser is generally Firefox: that's what most other applications are using to open a URL, including xdg-open
. So I was surprised that Emacs would do otherwise.
I finally figured out that Emacs is using the sensible-browser (1)
script. Looking at that script, I noticed that:
BROWSER
environment variable;gnome-www-browser
It so happens that, on my machine, BROWSER
is not set, but gnome-www-browser
is a script apparently put there by Chromium, and (naturally) running Chromium.
So, long story short: putting the following line
export BROWSER=firefox # Or any browser of your choice
in your .profile
may help if Emacs is not using the correct browser.
Setting the browser function is very easy using the GUI:
Options > Customize Emacs > Top-level customization Group
External
(Interfacing to external utilities.)Browse Url
(Use a web browser to look at a URL.)Browse Url Browser Function
, this reveals a Value Menu
button and some help textValue Menu
buttonApply and Save
to save the change to your ~/.emacs
fileDone :-)
I also had this problem when exporting org files to HTML. It would use Firefox instead of a Chromium browser. I fixed it by customizing org-file-apps
(which for some reason had been set to open XHTML and HTML files with Firefox).
I now have an entry for extension \.x?html?\'
with command set to the Lisp form: (browse-url file)
For ChrUbuntu, the google-chrome
incantation as given by Alan Turing works with Emacs 23.3.1, the default as of today. I suspect the chrubuntu configuration even when tickled to use chromium uses the wrong binary name.