changeset 110430:838a8c24850f

* lisp/url/url-cache.el (url-fetch-from-cache): New function.
author Glenn Morris <rgm@gnu.org>
date Sun, 19 Sep 2010 11:48:11 -0700
parents 06323f4d421b
children 9fe8167bbd9b
files lisp/url/ChangeLog lisp/url/url-cache.el
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/url/ChangeLog	Sun Sep 19 16:52:37 2010 +0200
+++ b/lisp/url/ChangeLog	Sun Sep 19 11:48:11 2010 -0700
@@ -1,3 +1,7 @@
+2010-09-19  Julien Danjou  <julien@danjou.info>
+
+	* url-cache.el (url-fetch-from-cache): New function.
+
 2010-09-18  Julien Danjou  <julien@danjou.info>
 
 	* url-vars.el (url-cache-expired): Remove unused variable.
--- a/lisp/url/url-cache.el	Sun Sep 19 16:52:37 2010 +0200
+++ b/lisp/url/url-cache.el	Sun Sep 19 11:48:11 2010 -0700
@@ -68,6 +68,12 @@
             (let ((coding-system-for-write 'binary))
               (write-region (point-min) (point-max) fname nil 5))))))
 
+(defun url-fetch-from-cache (url)
+  "Fetch URL from cache and return a buffer with the content."
+  (with-current-buffer (generate-new-buffer " *temp*")
+    (url-cache-extract (url-cache-create-filename url))
+    (current-buffer)))
+
 ;;;###autoload
 (defun url-is-cached (url)
   "Return non-nil if the URL is cached."