emacs/emacs-23.1-xdg.patch

50 lines
2.0 KiB
Diff

diff -u emacs-23.2/lisp/net/browse-url.el.xdg emacs-23.2/lisp/net/browse-url.el
--- emacs-23.2/lisp/net/browse-url.el.xdg 2010-04-04 08:26:06.000000000 +1000
+++ emacs-23.2/lisp/net/browse-url.el 2010-08-16 16:49:33.000000000 +1000
@@ -234,6 +234,7 @@
function is passed the URL and any other args of `browse-url'. The last
regexp should probably be \".\" to specify a default browser."
:type '(choice
+ (function-item :tag "Default freedesktop.org browser" :value browse-url-default-xdg-browser)
(function-item :tag "Emacs W3" :value browse-url-w3)
(function-item :tag "W3 in another Emacs via `gnudoit'"
:value browse-url-w3-gnudoit)
@@ -266,6 +267,23 @@
:version "21.1"
:group 'browse-url)
+;;;###autoload
+(defcustom browse-url-xdg-open-program "xdg-open"
+ "*The name by which to invoke xdg-open."
+ :type 'string
+ :group 'browse-url)
+
+
+;;;###autoload
+(defun browse-url-default-xdg-browser (url &optional new-window)
+ (interactive (browse-url-interactive-arg "URL: "))
+ (let ((process-environment (browse-url-process-environment))
+ (process-connection-type nil))
+ (start-process (concat browse-url-xdg-open-program " " url) nil
+ browse-url-xdg-open-program url)))
+
+
+
(defcustom browse-url-netscape-program "netscape"
;; Info about netscape-remote from Karl Berry.
"The name by which to invoke Netscape.
@@ -885,10 +903,12 @@
When called non-interactively, optional second argument NEW-WINDOW is
used instead of `browse-url-new-window-flag'.
-The order attempted is gnome-moz-remote, Mozilla, Firefox,
+The order attempted is xdg-open, gnome-moz-remote, Mozilla, Firefox,
Galeon, Konqueror, Netscape, Mosaic, Lynx in an xterm, and then W3."
(apply
(cond
+ ((executable-find browse-url-xdg-open-program)
+ 'browse-url-default-xdg-browser)
((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
((executable-find browse-url-mozilla-program) 'browse-url-mozilla)
((executable-find browse-url-firefox-program) 'browse-url-firefox)