]> code.delx.au - gnu-emacs/blobdiff - lisp/browse-url.el
(chinese-year-cache): Change range of years from
[gnu-emacs] / lisp / browse-url.el
index e719ecab3d2a5ebd1c96f01b467980c354207547..3be0331196baebfd0ed54d52de340f3fb42059bc 100644 (file)
 ;; browse-url-mmm        MMM         ?
 ;; browse-url-generic    arbitrary
 
+;; [The Netscape browser is now free software
+;; <URL:http://www.mozilla.org/>, albeit not GPLed, so it is
+;; reasonable to keep it as the default.]
+
 ;; Note that versions of Netscape before 1.1b1 did not have remote
 ;; control.  <URL:http://www.netscape.com/newsref/std/x-remote.html>.
 
-;; Netscape can cache Web pages so it may be necessary to tell it to
+;; Browsers can cache Web pages so it may be necessary to tell them to
 ;; reload the current page if it has changed (e.g. if you have edited
 ;; it).  There is currently no perfect automatic solution to this.
 
 ;; support for Java applets and multicast) can be used like Mosaic by
 ;; setting `browse-url-mosaic-program' appropriately.
 
-;; I [Denis Howe] recommend Nelson Minar <nelson@santafe.edu>'s excellent
-;; html-helper-mode.el for editing HTML and thank Nelson for
-;; his many useful comments on this code.
+;; I [Denis Howe, not Dave Love] recommend Nelson Minar
+;; <nelson@santafe.edu>'s excellent html-helper-mode.el for editing
+;; HTML and thank Nelson for his many useful comments on this code.
 ;; <URL:http://www.santafe.edu/%7Enelson/hhm-beta/>
 
 ;; See also hm--html-menus <URL:http://www.tnt.uni-hannover.de/%7Emuenkel/
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Variables
 
-(eval-when-compile (require 'dired)
-                  (require 'thingatpt)
+(eval-when-compile (require 'thingatpt)
                    (require 'term))
 
 (defgroup browse-url nil
@@ -426,8 +429,7 @@ These might set the port, for instance."
   :type '(repeat (string :tag "Argument"))
   :group 'browse-url)
 
-(defcustom browse-url-temp-dir
-  (or (getenv "TMPDIR") "/tmp")
+(defcustom browse-url-temp-dir temporary-file-directory
   "The name of a directory for browse-url's temporary files.
 Such files are generated by functions like `browse-url-of-region'.
 You might want to set this to somewhere with restricted read permissions
@@ -457,17 +459,11 @@ down (this *won't* always work)."
   :version "20.3"
   :group 'browse-url)
 
-(defcustom browse-url-lynx-input-attempts 10
-  "*How many times to try to move down from a series of lynx input fields."
-  :version "20.3"
-  :type 'integer
-  :group 'browse-url)
+(defvar browse-url-lynx-input-attempts 10
+  "*How many times to try to move down from a series of lynx input fields.")
 
 (defcustom browse-url-lynx-input-delay 0.2
-  "How many seconds to wait for lynx between moves down from an input field."
-  :version "20.3"
-  :type 'number
-  :group 'browse-url)
+  "How many seconds to wait for lynx between moves down from an input field.")
 
 (defvar browse-url-temp-file-list '())
 
@@ -700,9 +696,11 @@ the effect of `browse-url-new-window-p'.
 When called non-interactively, optional second argument NEW-WINDOW is
 used instead of `browse-url-new-window-p'."
   (interactive (browse-url-interactive-arg "Netscape URL: "))
-  ;; URL encode any commas in the URL
-  (while (string-match "," url)
-    (setq url (replace-match "%2C" t t 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 "netscape " url) nil
@@ -770,7 +768,7 @@ When called non-interactively, optional second argument NEW-WINDOW is
 used instead of `browse-url-new-window-p'."
   (interactive (browse-url-interactive-arg "Mosaic URL: "))
   (let ((pidfile (expand-file-name "~/.mosaicpid"))
-       pid pidbuf)
+       pid)
     (if (file-readable-p pidfile)
        (save-excursion
          (find-file pidfile)
@@ -819,11 +817,14 @@ variable `browse-url-grail'."
     (set-buffer (get-buffer-create " *Shell Command Output*"))
     (erase-buffer)
     ;; don't worry about this failing.
-    (call-process browse-url-grail nil 0 nil url)
+    (if new-window
+       (call-process browse-url-grail nil 0 nil "-b" url)
+      (call-process browse-url-grail nil 0 nil url))
     (message "Sending URL to Grail... done")))
 
 ;; --- Mosaic using CCI ---
 
+;;;###autoload
 (defun browse-url-cci (url &optional new-window)
   "Ask the XMosaic WWW browser to load URL.
 Default to the URL around or before point.