changeset 50574:b67822aa50a8

Don't autoload all these defcustoms. (browse-url-default-macosx-browser): New fun. (browse-url-browser-function): Use it for system-type = darwin. (browse-url-usr1-signal): Remove. (browse-url-mosaic): Use SIGUSR1 directly instead. (browse-url-gnome-moz-program): New var. (browse-url-gnome-moz, browse-url-default-browser): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 12 Apr 2003 22:21:18 +0000
parents e80e4ccf1bfc
children caadcafadb0c
files lisp/net/browse-url.el
diffstat 1 files changed, 18 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/browse-url.el	Sat Apr 12 21:39:50 2003 +0000
+++ b/lisp/net/browse-url.el	Sat Apr 12 22:21:18 2003 +0000
@@ -50,6 +50,7 @@
 ;; browse-url-mmm                     MMM         ?
 ;; browse-url-generic                 arbitrary
 ;; browse-url-default-windows-browser MS-Windows browser
+;; browse-url-default-macosx-browser  Mac OS X browser
 ;; browse-url-gnome-moz               GNOME interface to Mozilla
 ;; browse-url-kde                     KDE konqueror (kfm)
 
@@ -227,9 +228,11 @@
 
 ;;;###autoload
 (defcustom browse-url-browser-function
-  (if (memq system-type '(windows-nt ms-dos cygwin))
-      'browse-url-default-windows-browser
-    'browse-url-default-browser)
+  (cond
+   ((memq system-type '(windows-nt ms-dos cygwin))
+    'browse-url-default-windows-browser)
+   ((memq system-type '(darwin)) 'browse-url-default-macosx-browser)
+   (t 'browse-url-default-browser))
   "*Function to display the current buffer in a WWW browser.
 This is used by the `browse-url-at-point', `browse-url-at-mouse', and
 `browse-url-of-file' commands.
@@ -260,6 +263,8 @@
 			 :value browse-url-generic)
 	  (function-item :tag "Default Windows browser"
 			 :value browse-url-default-windows-browser)
+	  (function-item :tag "Default Mac OS X browser"
+			 :value browse-url-default-macosx-browser)
 	  (function-item :tag "GNOME invoking Mozilla"
 			 :value browse-url-gnome-moz)
 	  (function-item :tag "Default browser"
@@ -294,7 +299,6 @@
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-;;;###autoload
 (defcustom browse-url-browser-display nil
   "*The X display for running the browser, if not same as Emacs'."
   :type '(choice string (const :tag "Default" nil))
@@ -317,7 +321,6 @@
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-;;;###autoload
 (defcustom browse-url-galeon-program "galeon"
   "*The name by which to invoke Galeon."
   :type 'string
@@ -349,7 +352,6 @@
   :type 'boolean
   :group 'browse-url)
 
-;;;###autoload
 (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
@@ -408,7 +410,6 @@
   :version "20.3"
   :group 'browse-url)
 
-;;;###autoload
 (defcustom browse-url-save-file nil
   "*If non-nil, save the buffer before displaying its file.
 Used by the `browse-url-of-file' command."
@@ -424,15 +425,6 @@
   :options '(browse-url-netscape-reload)
   :group 'browse-url)
 
-(defvar browse-url-usr1-signal
-  (if (and (boundp 'emacs-major-version)
-	   (or (> emacs-major-version 19) (>= emacs-minor-version 29)))
-      'SIGUSR1 ; Why did I think this was in lower case before?
-    30)					; Check /usr/include/signal.h.
-  "The argument to `signal-process' for sending SIGUSR1 to XMosaic.
-Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer
-which is 30 on SunOS and 16 on HP-UX and Solaris.")
-
 (defcustom browse-url-CCI-port 3003
   "*Port to access XMosaic via CCI.
 This can be any number between 1024 and 65535 but must correspond to
@@ -484,7 +476,6 @@
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-;;;###autoload
 (defcustom browse-url-generic-program nil
   "*The name of the browser program used by `browse-url-generic'."
   :type '(choice string (const :tag "None" nil))
@@ -731,6 +722,10 @@
 	(error "Browsing URLs is not supported on this system"))
     (w32-shell-execute "open" url)))
 
+(defun browse-url-default-macosx-browser (url &optional new-window)
+  (interactive (browse-url-interactive-arg "URL: "))
+  (start-process (concat "open " url) nil "open" url))
+
 ;; --- Netscape ---
 
 (defun browse-url-process-environment ()
@@ -770,7 +765,7 @@
 Mosaic, IXI Mosaic, Lynx in an xterm, MMM, Konqueror, and then W3."
   (apply
     (cond
-     ((executable-find "gnome-moz-remote") 'browse-url-gnome-moz)
+     ((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-kde-program) 'browse-url-kde)
@@ -952,7 +947,7 @@
 	       (append browse-url-galeon-startup-arguments (list url))))))
 
 ;; GNOME means of invoking either Mozilla or Netrape.
-
+(defvar browse-url-gnome-moz-program "gnome-moz-remote")
 (defcustom browse-url-gnome-moz-arguments '()
   "*A list of strings passed to the GNOME mozilla viewer as arguments."
   :version "21.1"
@@ -975,7 +970,7 @@
   (interactive (browse-url-interactive-arg "URL: "))
   (apply 'start-process (concat "gnome-moz-remote " url)
 	 nil
-	 "gnome-moz-remote"
+	 browse-url-gnome-moz-program
 	 (append
 	  browse-url-gnome-moz-arguments
 	  (if (browse-url-maybe-new-window new-window)
@@ -1021,7 +1016,7 @@
 	  (kill-buffer nil)
 	  ;; Send signal SIGUSR to Mosaic
 	  (message "Signalling Mosaic...")
-	  (signal-process pid browse-url-usr1-signal)
+	  (signal-process pid 'SIGUSR1)
 	  ;; Or you could try:
 	  ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid))
 	  (message "Signalling Mosaic...done")
@@ -1034,7 +1029,6 @@
 
 ;; --- Grail ---
 
-;;;###autoload
 (defvar browse-url-grail
   (concat (or (getenv "GRAILDIR") "~/.grail") "/user/rcgrail.py")
   "Location of Grail remote control client script `rcgrail.py'.
@@ -1280,8 +1274,8 @@
 Default to the URL around or before point."
   (interactive (browse-url-interactive-arg "KDE URL: "))
   (message "Sending URL to KDE...")
-  (apply #'start-process `(,(concat "KDE" url) nil ,browse-url-kde-program
-			   ,@browse-url-kde-args ,url)))
+  (apply #'start-process (concat "KDE " url) nil browse-url-kde-program
+	                 (append browse-url-kde-args (list url))))
 
 (provide 'browse-url)