Daniel Novotny 618b2b
diff -up emacs-23.1/lisp/net/browse-url.el.xdg emacs-23.1/lisp/net/browse-url.el
Daniel Novotny 618b2b
--- emacs-23.1/lisp/net/browse-url.el.xdg	2009-09-18 15:10:03.000000000 -0400
Daniel Novotny 618b2b
+++ emacs-23.1/lisp/net/browse-url.el	2009-09-18 15:18:51.000000000 -0400
Daniel Novotny 618b2b
@@ -234,6 +234,7 @@ associated with the first REGEXP which m
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)
Daniel Novotny 618b2b
@@ -266,6 +267,23 @@ regexp should probably be \".\" to speci
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.
Daniel Novotny 618b2b
@@ -876,6 +894,8 @@ The order attempted is gnome-moz-remote,
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)