Last updated on November 16, 2016
The function browse-url
in Emacs can be used to start a browser process to visit a given URL. It is used by many packages such as org-mode
, mu4e
, etc. However, on GNU/Linux, by default a new browser process started by browse-url
will be killed if the Emacs process exits. To prevent the browser process from being killed, add the following code to your Emacs init file:
(when (and (executable-find "setsid") (executable-find "gnome-open"))
(setq browse-url-browser-function
(lambda (url &optional ignored)
(start-process "" nil "setsid" "gnome-open" url))))
You will need both the setsid
and gnome-open
commands available. Note that replacing gnome-open
with xdg-open
is not guaranteed to work.
Pingback: 2016-11-21 Emacs News - sacha chua :: living an awesome life