Revert "Emacs: Remove old browser-url settings, use xdg-open instead."

We need browser-url-generic-program for helm-exwm.

This reverts commit 95bc305917.
master
Pierre Neidhardt 2019-11-02 18:08:38 +01:00
parent 04c6910fb9
commit 85638901ae
1 changed files with 15 additions and 0 deletions

View File

@ -147,7 +147,22 @@
;; "s-w" 'other-window
"s-c" 'delete-window)
;; REVIEW: If xdg-open is not found, set Emacs URL browser to the environment browser,
;; or w3m if BROWSER is not set.
;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18986.
;; In Emacs 26, the BROWSER variable is still not checked.
(require 'browse-url)
(setq browse-url-generic-program (or
(executable-find (or (getenv "BROWSER") ""))
(when (executable-find "xdg-mime")
(let ((desktop-browser (ambrevar/call-process-to-string "xdg-mime" "query" "default" "text/html")))
(substring desktop-browser 0 (string-match "\\.desktop" desktop-browser))))
(executable-find browse-url-mozilla-program)
(executable-find browse-url-firefox-program)
(executable-find browse-url-chromium-program)
(executable-find browse-url-kde-program)
(executable-find browse-url-conkeror-program)
(executable-find browse-url-chrome-program)))
(setq browse-url-browser-function '(;; TODO: Display hyperspec in other window.
("http://www.lispworks.com/reference/HyperSpec/.*" . eww-browse-url)
("file:///.*HyperSpec.*" . eww-browse-url)