;ELC ;;; Compiled ;;; in Emacs version 27.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\312\313&\210\304\314\315\316\317\320\310\321\312\322& \207" [require url-parse url-util url custom-declare-variable url-cache-directory (expand-file-name "cache" url-configuration-directory) "The directory where cache files should be stored." :type directory :group url-file url-cache-expire-time 3600 "Default maximum time in seconds before cache files expire.\nUsed by the function `url-cache-expired'." :version "24.1" integer url-cache] 10) #@75 Follows the documentation of `file-writable-p', unlike `file-writable-p'. (defalias 'url-cache-file-writable-p #[(file) "\301!\205\302!\203\303!?\207\303\304!!\207" [file file-writable-p file-exists-p file-directory-p file-name-directory] 3 (#$ . 930)]) #@492 Makes it possible to cache data in FILE. Creates any necessary parent directories, deleting any non-directory files that would stop this. Returns nil if parent directories can not be created. If FILE already exists as a non-directory, it changes permissions of FILE or deletes FILE to make it possible to write a new version of FILE. Returns nil if this can not be done, or if FILE already exists as a directory. Otherwise, returns t, indicating that FILE can be created or overwritten. (defalias 'url-cache-prepare #[(file) "\301!\203\302\207\303!\203\304\207\3051 \306\307!\302\"\206\3020\207\210\304\207" [file url-cache-file-writable-p t file-directory-p nil (error) make-directory file-name-directory] 3 (#$ . 1199)]) #@33 Store buffer BUFF in the cache. (defalias 'url-store-in-cache #[(&optional buff) "r\303\206p!q\210\304\305\306!!\307 !\205 \310\311ed \312\313%)*\207" [buff fname coding-system-for-write get-buffer url-cache-create-filename url-view-url t url-cache-prepare binary write-region nil 5] 6 (#$ . 1942)]) #@60 Fetch URL from cache and return a buffer with the content. (defalias 'url-fetch-from-cache #[(url) "r\301\302!q\210\303\304!!\210p)\207" [url generate-new-buffer " *temp*" url-cache-extract url-cache-create-filename] 3 (#$ . 2254)]) #@111 Return non-nil if the URL is cached. The actual return value is the last modification time of the cache file. (defalias 'url-is-cached #[(url) "\303!\304 ! \205#\305 !\205#\n\211@\262\306=?\205#\n\3078\262*\207" [url fname attribs url-cache-create-filename file-attributes file-exists-p t 5] 3 (#$ . 2495)]) #@47 Return a filename in the local cache for URL. (defalias 'url-cache-create-filename-human-readable #[(url) "\205\372\306!\307 !\n>\204\310\311\300 D\"\210 \312H\307 !\n>\204*\310\311\300 D\"\210 \313H\314 \2065\315\316\317\f\206<\320\321\"!BB\307 !\n>\204Q\310\311\300 D\"\210 \322H\211 \203s G\323U\204s \323H\324U\203s\325 \312\326#  \203\204\326!\327\330 \331# ) \205\217\327\332 \331#\211 \204\231\326\202\346 \331\230\204\247 \333\230\203\254\"\202\346\334 !\324U\203\321\325 \335\326#\333\230\203\310 \"P\202\346\325 \312\326#\202\346\325 \335\326#\333\230\203\344 \"P\202\346 \211 \205\371\336 \336\327\337 \333##\"\"-\207" [url urlobj cl-struct-url-tags protocol hostname host-components url-generic-parse-url type-of signal wrong-type-argument 1 4 user-real-login-name "file" reverse split-string "localhost" "\\." 6 0 47 substring nil mapconcat #[(x) "\302U\203 \203\303\304\207\302U\203\305\306\207\303\307!\207" [x slash 47 nil "%2F" t "/" char-to-string] 2] #1="" #[(x) "\301U\203\302\207\303!\207" [x 126 #1# char-to-string] 2] "/" string-to-char -1 expand-file-name identity fname slash url-directory-index-file url-cache-directory] 8 (#$ . 2818)]) #@113 Create a cached filename using MD5. Very fast if you have an `md5' primitive function, suitably fast otherwise. (defalias 'url-cache-create-filename-using-md5 #[(url) "\205p\306!\307!\310\n! >\204\311\312\300\nD\"\210\n\313H\310\n! >\204.\311\312\300\nD\"\210\n\314H\315 \f\2069\316\317\320\321 \206A\322\323\"\"\237BB\310\n! >\204X\311\312\300\nD\"\210\n\324H\211\205n\325 \325\326\327\330#\"\".\207" [url checksum urlobj cl-struct-url-tags protocol hostname md5 url-generic-parse-url type-of signal wrong-type-argument 1 4 user-real-login-name "file" delq nil split-string "localhost" "\\." 6 expand-file-name mapconcat identity "/" host-components fname url-cache-directory] 8 (#$ . 4062)]) #@51 What function to use to create a cached filename. (custom-declare-variable 'url-cache-creation-function ''url-cache-create-filename-using-md5 '(#$ . 4786) :type '(choice (const :tag "MD5 of filename (low collision rate)" :value url-cache-create-filename-using-md5) (const :tag "Human readable filenames (higher collision rate)" :value url-cache-create-filename-human-readable) (function :tag "Other")) :group 'url-cache) (defalias 'url-cache-create-filename #[(url) "\303\304 !\n>\203 \202\305 !!!\207" [url-cache-creation-function url cl-struct-url-tags url-recreate-url type-of url-generic-parse-url] 4]) #@41 Extract FNAM from the local disk cache. (defalias 'url-cache-extract #[(fnam) "\301 \210\302\303!\210\304!\207" [fnam erase-buffer set-buffer-multibyte nil insert-file-contents-literally] 2 (#$ . 5404)]) #@192 Return non-nil if a cached URL is older than EXPIRE-TIME seconds. The default value of EXPIRE-TIME is `url-cache-expire-time'. If `url-standalone-mode' is non-nil, cached items never expire. (defalias 'url-cache-expired #[(url &optional expire-time) "\203 \305\306 !!?\207\307 !\211?\206\310\311\n \206\f\"\312\")\207" [url-standalone-mode url cache-time expire-time url-cache-expire-time file-exists-p url-cache-create-filename url-is-cached time-less-p time-add nil] 5 (#$ . 5616)]) #@124 Remove all expired files from the cache. `url-cache-expire-time' says how old a file has to be to be considered "expired". (defalias 'url-cache-prune-cache #[(&optional directory) "\306 \307\211 \206\f\f\310 !\205o\311 \312\"\313\211\203b@\314 !\315\235\204Y T\316 !\203@\317 !\203YT\202Y\320\321\322 !\3238\262\"\n\"\203Y\324 !\210TA\211\204* W?\205o\325 !\210\312+\207" [deleted-files total-files now directory url-cache-directory file current-time 0 file-exists-p directory-files t nil file-name-nondirectory ("." "..") file-directory-p url-cache-prune-cache time-less-p time-add file-attributes 5 delete-file delete-directory --dolist-tail-- url-cache-expire-time] 6 (#$ . 6115)]) (provide 'url-cache)