While there are some things I prefer in Chrome I try to use Firefox whenever possible as I think it’s important to have choices. However, we use Google Meet at my company and I’ve never gotten it to perform well in Firefox (I’m guessing it’s not one of Google’s top priorities).
This means I have to copy the links to the meeting and navigate there myself in Chrome. Since I use Org Mode to manage my calendar I thought, why not hack
browse-url to open Google Meet url’s in Chrome and save my self the trouble?
I took a look at the source code to figure out the best way to approach this and realized I wouldn’t need a hack after all.
browse-url already provides this functionality through the variable
browse-url-browser-function 1. From the documentation:
Function to display the current buffer in a WWW browser.
If the value is not a function it should be a list of pairs (REGEXP . FUNCTION). In this case the function called will be the one associated with the first REGEXP which matches the current URL.
So all I had to do was add the following to my init.org:
'(("meet.google.com" . browse-url-chrome)
;; catch all
("." . browse-url-default-browser)))
Now when I open a Google Meet link from Emacs it opens in Chrome, handy!
One area where I did run into some issues was getting
browse-url-chrome to work properly.
Setting up Chrome for Emacs on Mac
The default value for
"chromium" which I didn’t feel like installing on my system so I followed a suggestion online to create a
chrome executable script:
open -a 'Google Chrome' $*
I then saved that to the file
chrome in a directory on my
$PATH, marked it as executable, and configured
browse-url to use it:
(setq browse-url-chrome-program "chrome")
The use of an alist in this variable has been deprecated in Emacs 28. Use