unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4546: a patch: use xdg-open for opening URLs by default
       [not found] <154254044.520111253785066919.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
@ 2009-09-24  9:38 ` Daniel Novotny
  2009-09-24 16:57   ` Jan Djärv
  2009-09-24 18:58   ` Glenn Morris
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Novotny @ 2009-09-24  9:38 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

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.

[-- Attachment #2: emacs-23.1-xdg.patch --]
[-- Type: text/x-patch, Size: 1964 bytes --]

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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4546: a patch: use xdg-open for opening URLs by default
  2009-09-24  9:38 ` bug#4546: a patch: use xdg-open for opening URLs by default Daniel Novotny
@ 2009-09-24 16:57   ` Jan Djärv
  2009-09-24 18:58   ` Glenn Morris
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Djärv @ 2009-09-24 16:57 UTC (permalink / raw)
  To: Daniel Novotny, 4546; +Cc: bug-gnu-emacs

Does this patch have the problem discussed here:

http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg00279.html

?

	Jan D.


Daniel Novotny skrev:
> 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.
> 






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4546: a patch: use xdg-open for opening URLs by default
  2009-09-24  9:38 ` bug#4546: a patch: use xdg-open for opening URLs by default Daniel Novotny
  2009-09-24 16:57   ` Jan Djärv
@ 2009-09-24 18:58   ` Glenn Morris
  2009-09-25  9:50     ` Daniel Novotny
  1 sibling, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2009-09-24 18:58 UTC (permalink / raw)
  To: Daniel Novotny; +Cc: 4546

Daniel Novotny wrote:

> this patch comes from one of our users:

Thanks for forwarding things, but we need proper attribution for all
patches; ie who wrote it? Ideally, patches come with ChangeLog entries.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4546: a patch: use xdg-open for opening URLs by default
  2009-09-24 18:58   ` Glenn Morris
@ 2009-09-25  9:50     ` Daniel Novotny
  2010-10-07 18:20       ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Novotny @ 2009-09-25  9:50 UTC (permalink / raw)
  To: Glenn Morris

the credits go to Ville Skyttä (ville.skytta@iki.fi)
see https://bugzilla.redhat.com/show_bug.cgi?id=316131

 -Daniel

----- "Glenn Morris" <rgm@gnu.org> wrote:

> Daniel Novotny wrote:
> 
> > this patch comes from one of our users:
> 
> Thanks for forwarding things, but we need proper attribution for all
> patches; ie who wrote it? Ideally, patches come with ChangeLog
> entries.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#4546: a patch: use xdg-open for opening URLs by default
  2009-09-25  9:50     ` Daniel Novotny
@ 2010-10-07 18:20       ` Glenn Morris
  0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2010-10-07 18:20 UTC (permalink / raw)
  To: 4546-done

Version: 24.1

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-07 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <154254044.520111253785066919.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2009-09-24  9:38 ` bug#4546: a patch: use xdg-open for opening URLs by default Daniel Novotny
2009-09-24 16:57   ` Jan Djärv
2009-09-24 18:58   ` Glenn Morris
2009-09-25  9:50     ` Daniel Novotny
2010-10-07 18:20       ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).