Fix declaration typo
[bpt/emacs.git] / lisp / url / url.el
index 6d27627..43e52ef 100644 (file)
@@ -1,6 +1,7 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001, 2004-2013 Free Software Foundation,
+;; Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
@@ -26,7 +27,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 
 (require 'mailcap)
 
@@ -132,9 +132,9 @@ characters are percent-encoded; see `url-encode-url'.
 CALLBACK is called when the object has been completely retrieved, with
 the current buffer containing the object, and any MIME headers associated
 with it.  It is called as (apply CALLBACK STATUS CBARGS).
-STATUS is a list with an even number of elements representing
-what happened during the request, with most recent events first,
-or an empty list if no events have occurred.  Each pair is one of:
+STATUS is a plist representing what happened during the request,
+with most recent events first, or an empty list if no events have
+occurred.  Each pair is one of:
 
 \(:redirect REDIRECTED-TO) - the request was redirected to this URL
 \(:error (ERROR-SYMBOL . DATA)) - an error occurred.  The error can be
@@ -170,8 +170,10 @@ URL-encoded before it's used."
 (defun url-retrieve-internal (url callback cbargs &optional silent
                                  inhibit-cookies)
   "Internal function; external interface is `url-retrieve'.
-CBARGS is what the callback will actually receive - the first item is
-the list of events, as described in the docstring of `url-retrieve'.
+CBARGS is the list of arguments that the callback function will
+receive; its first element should be a plist specifying what has
+happened so far during the request, as described in the docstring
+of `url-retrieve' (if in doubt, specify nil).
 
 If SILENT, don't message progress reports and the like.
 If INHIBIT-COOKIES, cookies will neither be stored nor sent to
@@ -180,9 +182,9 @@ If URL is a multibyte string, it will be encoded as utf-8 and
 URL-encoded before it's used."
   (url-do-setup)
   (url-gc-dead-buffers)
-  (if (stringp url)
-      (set-text-properties 0 (length url) nil url))
-  (setq url (url-encode-url url))
+  (when (stringp url)
+    (set-text-properties 0 (length url) nil url)
+    (setq url (url-encode-url url)))
   (if (not (vectorp url))
       (setq url (url-generic-parse-url url)))
   (if (not (functionp callback))
@@ -288,6 +290,12 @@ no further processing).  URL is either a string or a parsed URL."
                              (get-buffer-process asynch-buffer)))))))
       asynch-buffer)))
 
+;; url-mm-callback called from url-mm, which requires mm-decode.
+(declare-function mm-dissect-buffer "mm-decode"
+                 (&optional no-strict-mime loose-mime from))
+(declare-function mm-display-part "mm-decode"
+                 (handle &optional no-default force))
+
 (defun url-mm-callback (&rest ignored)
   (let ((handle (mm-dissect-buffer t)))
     (url-mark-buffer-as-dead (current-buffer))