(vip-shift-width): Doc fix.
[bpt/emacs.git] / lisp / browse-url.el
index e99462a..542e6bb 100644 (file)
 
 ;; Do any other browsers have remote control?
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Installation
-
-;; Put the following in your ~/.emacs file:
-;;
-;; (autoload 'browse-url-at-point "browse-url"
-;;   "Ask a WWW browser to load the URL at or before point." t)
-;; (autoload 'browse-url-at-mouse "browse-url"
-;;   "Ask a WWW browser to load a URL clicked with the mouse." t)
-;; (autoload 'browse-url-of-buffer "browse-url"
-;;   "Ask a WWW browser to display BUFFER." t)
-;; (autoload 'browse-url-of-file "browse-url"
-;;   "Ask a WWW browser to display FILE." t)
-;; (autoload 'browse-url-of-dired-file "browse-url"
-;;   "In Dired, ask a WWW browser to display the file named on this line."
-t)
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Usage
 
@@ -114,7 +97,9 @@ t)
 
 ;; To display a URL by shift-clicking on it, put this in your ~/.emacs
 ;; file:
-;;      (global-set-key [S-mouse-1] 'browse-url-at-mouse)
+;;      (global-set-key [S-mouse-2] 'browse-url-at-mouse)
+;; (Note that using Shift-mouse-1 is not desirable because
+;; that event has a standard meaning in Emacs.)
 
 ;; To display the current buffer in a web browser:
 ;; M-x browse-url-of-buffer RET
@@ -133,9 +118,8 @@ t)
 ;;      (global-set-key "\C-cub" 'browse-url-of-buffer)
 ;;      (global-set-key "\C-cuf" 'browse-url-of-file)
 ;;      (add-hook 'dired-mode-hook
-;;                (function (lambda ()
-;;                            (local-set-key "\C-cuf"
-'browse-url-of-dired-file))))
+;;                (lambda ()
+;;                  (local-set-key "\C-cuf" 'browse-url-of-dired-file))))
 ;;      (if (boundp 'browse-url-browser-function)
 ;;          (global-set-key "\C-cuu" browse-url-browser-function)
 ;;        (eval-after-load
@@ -162,10 +146,8 @@ t)
 ;;                                (let ((local-write-file-hooks))
 ;;                                  (save-buffer))
 ;;                                (browse-url-netscape-reload)
-;;                                t))                   ; => file written
-by hook
-;;                             t))))                    ; append to
-l-w-f-hooks
+;;                                t))                   ; => file written by hook
+;;                             t))))                    ; append to l-w-f-hooks
 ;;
 ;; [Does this work for html-mode too?]
 ;;
@@ -274,8 +256,7 @@ l-w-f-hooks
 ;;; Code:
 
 (defvar browse-url-regexp
-  "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mai
-lto:\\)[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+"
+  "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+"
   "A regular expression probably matching a URL.")
 
 (defvar browse-url-browser-function
@@ -317,10 +298,10 @@ file rather than displaying a cached copy.")
 (defvar browse-url-usr1-signal
   (if (and (boundp 'emacs-major-version)
            (or (> emacs-major-version 19) (>= emacs-minor-version 29)))
-      'sigusr1
+      'SIGUSR1
     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
+Emacs 19.29 accepts 'SIGUSR1, earlier versions require an integer
 which is 30 on SunOS and 16 on HP-UX and Solaris.")
 
 (defvar browse-url-CCI-port 3003
@@ -360,12 +341,14 @@ use in `interactive'."
     (and (listp event) (mouse-set-point event)))
   (list (read-string (or prompt "URL: ") (browse-url-url-at-point))))
 
+;;;###autoload
 (defun browse-url-at-point ()
   "Ask a WWW browser to load the URL at or before point.
 The URL is loaded according to the value of `browse-url-browser-function'."
   (interactive)
   (funcall browse-url-browser-function (browse-url-url-at-point)))
 
+;;;###autoload
 (defun browse-url-at-mouse (event)
   "Ask a WWW browser to load a URL clicked with the mouse.
 The URL is the one around or before the position of the mouse click
@@ -384,6 +367,7 @@ but point is not changed.  The URL is loaded according to the value of
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Browse current buffer
 
+;;;###autoload
 (defun browse-url-of-file (&optional file)
   "Ask a WWW browser to display FILE.
 Display the current buffer's file if FILE is nil or if called
@@ -426,6 +410,7 @@ Uses variable `browse-url-filename-alist' to map filenames to URLs."
 
 (defvar browse-url-temp-file-list '())
 
+;;;###autoload
 (defun browse-url-of-buffer (&optional buffer)
   "Ask a WWW browser to display BUFFER.
 Display the current buffer if BUFFER is nil."
@@ -474,6 +459,7 @@ Display the current buffer if BUFFER is nil."
 (add-hook 'kill-buffer-hook 'browse-url-delete-temp-file)
 (add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list)
 
+;;;###autoload
 (defun browse-url-of-dired-file ()
   "In Dired, ask a WWW browser to display the file named on this line."
   (interactive)
@@ -510,7 +496,8 @@ used instead of browse-url-new-window-p."
       (progn                            ; Netscape not running - start it
         (message "Starting Netscape...")
         (apply 'start-process "netscape" nil "netscape"
-               (append browse-url-netscape-arguments (list url))))))
+               (append browse-url-netscape-arguments (list url)))
+        (message "Starting Netscape...done"))))
 
 (defun browse-url-netscape-reload ()
   "Ask Netscape to reload its current document."
@@ -543,15 +530,16 @@ Default to the URL around or before point."
           (save-buffer)
           (kill-buffer nil)
           ;; Send signal SIGUSR to Mosaic
-          (message "Signalling Mosaic...")
           (signal-process pid browse-url-usr1-signal)
+          (message "Signal sent to Mosaic")
           ;; Or you could try:
           ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid))
           )
       ;; Mosaic not running - start it
       (message "Starting Mosaic...")
       (apply 'start-process "xmosaic" nil "xmosaic"
-             (append browse-url-mosaic-arguments (list url))))))
+             (append browse-url-mosaic-arguments (list url)))
+      (message "Starting Mosaic...done"))))
 
 (defun browse-url-cci (url &optional new-window)
   "Ask the XMosaic WWW browser to load URL.