Subject: bug#4546: closed (Re: bug#4546: a patch: use xdg-open for opening URLs by default)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 07 Oct 2010 18:18:02 +0000

Your bug report

#4546: a patch: use xdg-open for opening URLs by default

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
4546: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4546
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#4546: a patch: use xdg-open for opening URLs by default
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Thu, 07 Oct 2010 14:20:24 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.1

The function browse-url-default-browser uses xdg-open now if it can.

Subject: a patch: use xdg-open for opening URLs by default
From: Daniel Novotny <[email-masked]>
To: [email-masked]
Date: Thu, 24 Sep 2009 05:38:17 -0400 (EDT)

hello,

this patch comes from one of our users:
it uses xdg-open(1) command for "M-x browse-url",
so the URL is opened in the browser, which is
set as the default browser by the user in his/her
desktop settings

see attachment.

best regards, have a nice day,

 Daniel Novotny, Red Hat inc.

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