* url-handlers.el (file-remote-p): Add handler.
[bpt/emacs.git] / lisp / url / url.el
index 6e4dfa0..34b3f65 100644 (file)
@@ -1,7 +1,7 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool
 
 ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004,
-;;   2005, 2006  Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
@@ -10,7 +10,7 @@
 ;;
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 ;;
 ;; GNU Emacs is distributed in the hope that it will be useful,
 (require 'url-parse)
 (require 'url-util)
 
-;; Fixme: customize? convert-standard-filename?
-(defvar url-configuration-directory
-  (cond
-   ((file-directory-p "~/.url") "~/.url")
-   ((file-directory-p "~/.emacs.d") "~/.emacs.d/url")
-   (t "~/.url")))
+
+;; FIXME convert-standard-filename?
+(defcustom url-configuration-directory
+  (if (and (file-directory-p user-emacs-directory)
+           (not (file-directory-p "~/.url")))
+      (expand-file-name "url" user-emacs-directory)
+    "~/.url")
+  "Directory used by the URL package for cookies, history, etc."
+  :type 'directory
+  :group 'url)
 
 (defun url-do-setup ()
   "Setup the url package.
@@ -240,16 +244,24 @@ no further processing).  URL is either a string or a parsed URL."
                ;; XXX: The callback must always be called.  Any
                ;; exception is a bug that should be fixed, not worked
                ;; around.
-                (setq retrieval-done t))
+               (progn ;; Call delete-process so we run any sentinel now.
+                 (delete-process proc)
+                 (setq retrieval-done t)))
             ;; We used to use `sit-for' here, but in some cases it wouldn't
             ;; work because apparently pending keyboard input would always
             ;; interrupt it before it got a chance to handle process input.
             ;; `sleep-for' was tried but it lead to other forms of
             ;; hanging.  --Stef
-            (unless (or (accept-process-output proc) (null proc))
+            (unless (or (with-local-quit 
+                         (accept-process-output proc))
+                       (null proc))
               ;; accept-process-output returned nil, maybe because the process
-              ;; exited (and may have been replaced with another).
-              (setq proc (get-buffer-process asynch-buffer))))))
+              ;; exited (and may have been replaced with another).  If we got
+             ;; a quit, just stop.
+             (when quit-flag
+               (delete-process proc))
+              (setq proc (and (not quit-flag)
+                             (get-buffer-process asynch-buffer)))))))
       asynch-buffer)))
 
 (defun url-mm-callback (&rest ignored)