1. xemacs
  2. mail-lib

Commits

simon  committed 38a5186

2006-09-12 Steve Youngs <steve@sxemacs.org>

* browse-url.el (browse-url-browser-function): Add item for
SeaMonkey.
(browse-url-seamonkey-program): New.
(browse-url-seamonkey-arguments): New.
(browse-url-seamonkey-startup-arguments): New.
(browse-url-seamonkey-new-window-is-tab): New.
(browse-url-default-browser): Add SeaMonkey.
(browse-url-seamonkey): New.
(browse-url-seamonkey-sentinel): New.

This adds SeaMonkey to the available browser choices in
browse-url.

  • Participants
  • Parent commits e9034ae
  • Branches default

Comments (0)

Files changed (2)

File ChangeLog

View file
  • Ignore whitespace
+2006-09-12  Steve Youngs  <steve@sxemacs.org>
+
+	* browse-url.el (browse-url-browser-function): Add item for
+	SeaMonkey. 
+	(browse-url-seamonkey-program): New.
+	(browse-url-seamonkey-arguments): New.
+	(browse-url-seamonkey-startup-arguments): New.
+	(browse-url-seamonkey-new-window-is-tab): New.
+	(browse-url-default-browser): Add SeaMonkey.
+	(browse-url-seamonkey): New.
+	(browse-url-seamonkey-sentinel): New.
+
+	This adds SeaMonkey to the available browser choices in
+	browse-url. 
+
 2006-07-17  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.77 released.

File browse-url.el

View file
  • Ignore whitespace
 ;; some of them probably now obsolete:
 
 ;; Function                           Browser     Earliest version
+;; browse-url-seamonkey               SeaMonkey   1st tried with 1.0.4
 ;; browse-url-mozilla                 Mozilla     Don't know
 ;; browse-url-firefox                 Firefox     Don't know (1st tried with 1.0.1)
 ;; browse-url-galeon                  Galeon      Don't know
 	  (function-item :tag "Emacs W3M" :value  browse-url-w3)
 	  (function-item :tag "W3M in another Emacs via `gnudoit'"
 			 :value  browse-url-w3-gnudoit)
+	  (function-item :tag "SeaMonkey" :value browse-url-seamonkey)
 	  (function-item :tag "Mozilla" :value  browse-url-mozilla)
 	  (function-item :tag "Firefox" :value browse-url-firefox)
 	  (function-item :tag "Galeon" :value  browse-url-galeon)
   :group 'browse-url)
 
 ;;;###autoload
+(defcustom browse-url-seamonkey-program "seamonkey"
+  "*The name by which to invoke SeaMonkey."
+  :type 'string
+  :group 'browse-url)
+
+(defcustom browse-url-seamonkey-arguments nil
+  "*A list of strings to pass to SeaMonkey as arguments."
+  :type '(repeat (string :tag "Argument"))
+  :group 'browse-url)
+
+(defcustom browse-url-seamonkey-startup-arguments browse-url-seamonkey-arguments
+  "*A list of strings to pass to SeaMonkey when it starts up.
+Defaults to the value of `browse-url-seamonkey-arguments' at the time
+`browse-url' is loaded."
+  :type '(repeat (string :tag "Argument"))
+  :group 'browse-url)
+
+;;;###autoload
 (defcustom browse-url-mozilla-program "mozilla"
   "*The name by which to invoke Mozilla."
   :type 'string
 :type '(repeat (string :tag "Argument"))
 :group 'browse-url)
 
+(defcustom browse-url-seamonkey-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-seamonkey' is asked to open it in a new window."
+  :type 'boolean
+  :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
 used instead of `browse-url-new-window-flag'.
 
 The order attempted is emacs-w3m, gnome-moz-remote, Mozilla, Firefox,
-Galeon, Konqueror, Netscape, Opera, Mosaic, IXI Mosaic, Lynx in an
-xterm, MMM, and then W3."
+SeaMonkey, Galeon, Konqueror, Netscape, Opera, Mosaic, IXI Mosaic,
+Lynx in an xterm, MMM, 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-firefox-program) 'browse-url-firefox)
+     ((executable-find browse-url-seamonkey-program) 'browse-url-seamonkey)
      ((executable-find browse-url-galeon-program) 'browse-url-galeon)
      ((executable-find browse-url-kde-program) 'browse-url-kde)
      ((executable-find browse-url-netscape-program) 'browse-url-netscape)
                    (list "-remote" command)))))
 
 ;;;###autoload
+(defun browse-url-seamonkey (url &optional new-window)
+  "Ask the SeaMonkey WWW browser to load URL.
+Default to the URL around or before point.  The strings in variable
+`browse-url-seamonkey-arguments' are also passed to SeaMonkey.
+
+When called interactively, if variable `browse-url-new-window-flag' is
+non-nil, load the document in a new SeaMonkey 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-seamonkey-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'.
+
+On MS-Windows systems the optional `new-window' parameter is ignored.
+SeaMonkey for Windows does not support the \"-remote\" command line
+parameter. Therefore the `browse-url-new-window-flag', 
+`browse-url-new-window-flag' and `browse-url-seamonkey-new-window-is-tab'
+are ignored as well. SeaMonkey on Windows will always open the
+requested URL in a new window."
+  (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 "seamonkey " url) nil
+		 browse-url-seamonkey-program
+		 (append
+		  browse-url-seamonkey-arguments
+          (if (or (featurep 'dos-w32)
+                  (string-match "win32" system-configuration))
+              (list url)
+            (list "-remote"
+                  (concat "openURL("
+                          url
+                          (if (browse-url-maybe-new-window
+                               new-window)
+                              (if browse-url-seamonkey-new-window-is-tab
+                                  ",new-tab"
+                                ",new-window"))
+                          ")")))))))
+    (set-process-sentinel process
+			  `(lambda (process change)
+			     (browse-url-seamonkey-sentinel process ,url)))))
+
+(defun browse-url-seamonkey-sentinel (process url)
+  "Handle a change to the process communicating with SeaMonkey."
+  (or (eq (process-exit-status process) 0)
+      (let* ((process-environment (browse-url-process-environment)))
+	;; SeaMonkey is not running - start it
+	(message "Starting SeaMonkey...")
+	(apply 'start-process (concat "seamonkey " url) nil
+	       browse-url-seamonkey-program
+	       (append browse-url-seamonkey-startup-arguments (list url))))))
+
+;;;###autoload
 (defun browse-url-mozilla (url &optional new-window)
   "Ask the Mozilla WWW browser to load URL.
 Default to the URL around or before point.  The strings in variable