comparison lisp/url/url-cache.el @ 83353:532e0a9335a9

Merged in changes from CVS trunk. Plus added lisp/term tweaks. Patches applied: * lorentey@elte.hu--2004/emacs--cvs-trunk--0--base-0 tag of miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-474 * lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-1 Add CVS metadata files. * lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-2 Update from CVS. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-393
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 04 Sep 2005 03:48:17 +0000
parents 6c13700d1c13 875dcc490074
children ec395f552d45
comparison
equal deleted inserted replaced
83352:b258b3492423 83353:532e0a9335a9
1 ;;; url-cache.el --- Uniform Resource Locator retrieval tool 1 ;;; url-cache.el --- Uniform Resource Locator retrieval tool
2 2
3 ;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc. 3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2004,
4 ;; 2005 Free Software Foundation, Inc.
4 5
5 ;; Keywords: comm, data, processes, hypermedia 6 ;; Keywords: comm, data, processes, hypermedia
6 7
7 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
8 9
37 "Follows the documentation of `file-writable-p', unlike `file-writable-p'." 38 "Follows the documentation of `file-writable-p', unlike `file-writable-p'."
38 (and (file-writable-p file) 39 (and (file-writable-p file)
39 (if (file-exists-p file) 40 (if (file-exists-p file)
40 (not (file-directory-p file)) 41 (not (file-directory-p file))
41 (file-directory-p (file-name-directory file))))) 42 (file-directory-p (file-name-directory file)))))
42 43
43 (defun url-cache-prepare (file) 44 (defun url-cache-prepare (file)
44 "Makes it possible to cache data in FILE. 45 "Makes it possible to cache data in FILE.
45 Creates any necessary parent directories, deleting any non-directory files 46 Creates any necessary parent directories, deleting any non-directory files
46 that would stop this. Returns nil if parent directories can not be 47 that would stop this. Returns nil if parent directories can not be
47 created. If FILE already exists as a non-directory, it changes 48 created. If FILE already exists as a non-directory, it changes
68 (and buff (set-buffer buff)) 69 (and buff (set-buffer buff))
69 (let* ((fname (url-cache-create-filename (url-view-url t)))) 70 (let* ((fname (url-cache-create-filename (url-view-url t))))
70 (if (url-cache-prepare fname) 71 (if (url-cache-prepare fname)
71 (let ((coding-system-for-write 'binary)) 72 (let ((coding-system-for-write 'binary))
72 (write-region (point-min) (point-max) fname nil 5))))))) 73 (write-region (point-min) (point-max) fname nil 5)))))))
73 74
74 ;;;###autoload 75 ;;;###autoload
75 (defun url-is-cached (url) 76 (defun url-is-cached (url)
76 "Return non-nil if the URL is cached." 77 "Return non-nil if the URL is cached."
77 (let* ((fname (url-cache-create-filename url)) 78 (let* ((fname (url-cache-create-filename url))
78 (attribs (file-attributes fname))) 79 (attribs (file-attributes fname)))