all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Novotny <dnovotny@redhat.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#4546: a patch: use xdg-open for opening URLs by default
Date: Thu, 24 Sep 2009 05:38:17 -0400 (EDT)	[thread overview]
Message-ID: <423891842.520131253785097842.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <154254044.520111253785066919.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>

[-- 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)

       reply	other threads:[~2009-09-24  9:38 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=423891842.520131253785097842.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com \
    --to=dnovotny@redhat.com \
    --cc=4546@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.