emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/browse-url.el


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/net/browse-url.el
Date: Mon, 07 Jul 2003 16:54:56 -0400

Index: emacs/lisp/net/browse-url.el
diff -c emacs/lisp/net/browse-url.el:1.29 emacs/lisp/net/browse-url.el:1.30
*** emacs/lisp/net/browse-url.el:1.29   Wed May 28 07:24:00 2003
--- emacs/lisp/net/browse-url.el        Mon Jul  7 16:54:56 2003
***************
*** 39,44 ****
--- 39,45 ----
  ;; 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,253 ****
--- 249,255 ----
                         :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,343 ****
--- 340,362 ----
    :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 Epiphany as 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,357 ****
--- 371,383 ----
    :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
***************
*** 922,928 ****
               (format "%%%x" (string-to-char (match-string 0 url))) t t url)))
    (let* ((process-environment (browse-url-process-environment))
           (process (apply 'start-process
!                        (concat "galeon " url) nil
                         browse-url-galeon-program
                         (append
                          browse-url-galeon-arguments
--- 948,955 ----
               (format "%%%x" (string-to-char (match-string 0 url))) t t url)))
    (let* ((process-environment (browse-url-process-environment))
           (process (apply 'start-process
!                        (concat "galeon " url)
!                        nil
                         browse-url-galeon-program
                         (append
                          browse-url-galeon-arguments
***************
*** 945,950 ****
--- 972,1026 ----
        (apply 'start-process (concat "galeon " url) nil
               browse-url-galeon-program
               (append browse-url-galeon-startup-arguments (list url))))))
+ 
+ (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-galeon-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-galeon-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")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]