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