unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* PATCH: add support for Epiphany browser
@ 2003-06-25 20:49 David Roth
  0 siblings, 0 replies; only message in thread
From: David Roth @ 2003-06-25 20:49 UTC (permalink / raw)


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

Hi,

a simple patch to add support for the epiphany browser to browse-url.el

Dave


2003-06-25  David Roth  <dxr@dxr.org>
	* net/browse-url.el: Support Epiphany.
	(browse-url-epiphany, browse-url-epiphany-sentinel): New functions.
        (browse-url-epiphany-program, browse-url-epiphany-new-window-is-tab)
	(browse-url-epiphany-arguments, browse-url-epiphany-startup-arguments): New vars.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ephy.patch --]
[-- Type: text/x-patch, Size: 6044 bytes --]

Index: lisp/net/browse-url.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/browse-url.el,v
retrieving revision 1.29
diff -u -r1.29 browse-url.el
--- lisp/net/browse-url.el	28 May 2003 11:24:00 -0000	1.29
+++ lisp/net/browse-url.el	23 Jun 2003 22:21:28 -0000
@@ -39,6 +39,7 @@
 ;; Function                           Browser     Earliest version
 ;; browse-url-mozilla                 Mozilla     Don't know
 ;; browse-url-galeon                  Galeon      Don't know
+;; browse-url-epiphany                Epiphany    Don't know
 ;; browse-url-netscape                Netscape    1.1b1
 ;; browse-url-mosaic                  XMosaic/mMosaic <= 2.4
 ;; browse-url-cci                     XMosaic     2.5
@@ -248,6 +249,7 @@
 			 :value  browse-url-w3-gnudoit)
 	  (function-item :tag "Mozilla" :value  browse-url-mozilla)
 	  (function-item :tag "Galeon" :value  browse-url-galeon)
+	  (function-item :tag "Epiphany" :value  browse-url-epiphany)
 	  (function-item :tag "Netscape" :value  browse-url-netscape)
 	  (function-item :tag "Mosaic" :value  browse-url-mosaic)
 	  (function-item :tag "Mosaic using CCI" :value  browse-url-cci)
@@ -338,6 +340,23 @@
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
+(defcustom browse-url-epiphany-program "epiphany"
+  "*The name by which to invoke Epiphany."
+  :type 'string
+  :group 'browse-url)
+
+(defcustom browse-url-epiphany-arguments nil
+  "*A list of strings to pass to Epiphanyas arguments."
+  :type '(repeat (string :tag "Argument"))
+  :group 'browse-url)
+
+(defcustom browse-url-epiphany-startup-arguments browse-url-epiphany-arguments
+  "*A list of strings to pass to Epiphany when it starts up.
+Defaults to the value of `browse-url-epiphany-arguments' at the time
+`browse-url' is loaded."
+  :type '(repeat (string :tag "Argument"))
+  :group 'browse-url)
+
 (defcustom browse-url-mozilla-new-window-is-tab nil
   "*Whether to open up new windows in a tab or a new window.
 If non-nil, then open the URL in a new tab rather than a new window if
@@ -352,6 +371,13 @@
   :type 'boolean
   :group 'browse-url)
 
+(defcustom browse-url-epiphany-new-window-is-tab nil
+  "*Whether to open up new windows in a tab or a new window.
+If non-nil, then open the URL in a new tab rather than a new window if
+`browse-url-epiphany' is asked to open it in a new window."
+  :type 'boolean
+  :group 'browse-url)
+
 (defcustom browse-url-new-window-flag nil
   "*If non-nil, always open a new browser window with appropriate browsers.
 Passing an interactive argument to \\[browse-url], or specific browser
@@ -761,13 +787,14 @@
 When called non-interactively, optional second argument NEW-WINDOW is
 used instead of `browse-url-new-window-flag'.
 
-The order attempted is gnome-moz-remote, Mozilla, Galeon, Netscape,
+The order attempted is gnome-moz-remote, Mozilla, Galeon, Epiphany, Netscape,
 Mosaic, IXI Mosaic, Lynx in an xterm, MMM, Konqueror, and then W3."
   (apply
     (cond
      ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz)
      ((executable-find browse-url-mozilla-program) 'browse-url-mozilla)
      ((executable-find browse-url-galeon-program) 'browse-url-galeon)
+     ((executable-find browse-url-epiphany-program) 'browse-url-epiphany)
      ((executable-find browse-url-kde-program) 'browse-url-kde)
      ((executable-find browse-url-netscape-program) 'browse-url-netscape)
      ((executable-find browse-url-mosaic-program) 'browse-url-mosaic)
@@ -945,6 +972,55 @@
 	(apply 'start-process (concat "galeon " url) nil
 	       browse-url-galeon-program
 	       (append browse-url-galeon-startup-arguments (list url))))))
+
+;;;###autoload
+(defun browse-url-epiphany (url &optional new-window)
+  "Ask the Epiphany WWW browser to load URL.
+Default to the URL around or before point.  The strings in variable
+`browse-url-epiphany-arguments' are also passed to Epiphany.
+
+When called interactively, if variable `browse-url-new-window-flag' is
+non-nil, load the document in a new Epiphany window, otherwise use a
+random existing one.  A non-nil interactive prefix argument reverses
+the effect of `browse-url-new-window-flag'.
+
+If `browse-url-epiphany-new-window-is-tab' is non-nil, then whenever a
+document would otherwise be loaded in a new window, it is loaded in a
+new tab in an existing window instead.
+
+When called non-interactively, optional second argument NEW-WINDOW is
+used instead of `browse-url-new-window-flag'."
+  (interactive (browse-url-interactive-arg "URL: "))
+  ;; URL encode any `confusing' characters in the URL.  This needs to
+  ;; include at least commas; presumably also close parens.
+  (while (string-match "[,)]" url)
+    (setq url (replace-match
+	       (format "%%%x" (string-to-char (match-string 0 url))) t t url)))
+  (let* ((process-environment (browse-url-process-environment))
+         (process (apply 'start-process
+			 (concat "epiphany " url) nil
+			 browse-url-epiphany-program
+			 (append
+			  browse-url-epiphany-arguments
+                          (if (browse-url-maybe-new-window new-window)
+			      (if browse-url-epiphany-new-window-is-tab
+				  '("--new-tab")
+				'("--new-window" "--noraise"))
+                            '("--existing"))
+                          (list url)))))
+    (set-process-sentinel process
+			  `(lambda (process change)
+			     (browse-url-epiphany-sentinel process ,url)))))
+
+(defun browse-url-epiphany-sentinel (process url)
+  "Handle a change to the process communicating with Epiphany."
+  (or (eq (process-exit-status process) 0)
+      (let* ((process-environment (browse-url-process-environment)))
+	;; Epiphany is not running - start it
+	(message "Starting Epiphany...")
+	(apply 'start-process (concat "epiphany " url) nil
+	       browse-url-epiphany-program
+	       (append browse-url-epiphany-startup-arguments (list url))))))
 
 ;; GNOME means of invoking either Mozilla or Netrape.
 (defvar browse-url-gnome-moz-program "gnome-moz-remote")

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-06-25 20:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-25 20:49 PATCH: add support for Epiphany browser David Roth

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