;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307DD\310\311\312\313\314\313\315& \210\303\316\305\306\317DD\320\313\315\311\321&\210\303\322\305\306\323DD\324\313\315\311\306&\207" [require pdf-info pdf-util custom-declare-variable pdf-cache-image-limit funcall function #[0 "\300\207" [64] 1] "Maximum number of cached PNG images per buffer." :type integer :group pdf-cache pdf-view pdf-cache-prefetch-delay #[0 "\300\207" [0.5] 1] "Idle time in seconds before prefetching images starts." number pdf-cache-prefetch-pages-function #[0 "\300\207" [pdf-cache-prefetch-pages-function-default] 1] "A function returning a list of pages to be prefetched.\n\nIt is called with no arguments in the PDF window and should\nreturn a list of page-numbers, determining the pages that should\nbe prefetched and their order."] 10) (defvar pdf-cache--data nil nil) (make-variable-buffer-local 'pdf-cache--data) (defalias 'pdf-cache--initialize #[0 "?\205\301 \302\303\304\305\306$\210\302\307\310\305\306$\207" [pdf-cache--data make-hash-table add-hook pdf-info-close-document-hook pdf-cache-clear-data nil t pdf-annot-modified-functions pdf-cache--clear-data-of-annotations] 5]) #@11 (fn FN) (defalias 'pdf-cache--clear-data-of-annotations #[257 "\300\301\302\303\304!\"\"\207" [apply pdf-cache-clear-data-of-pages mapcar #[257 "\300\236A\207" [page] 3 "\n\n(fn A)"] t] 7 (#$ . 1266)]) #@87 Put KEY with VALUE in the cache of PAGE, return value. (fn KEY VALUE &optional PAGE) (defalias 'pdf-cache--data-put #[770 "\301 \210\302B\303\304\"\"B#\210\207" [pdf-cache--data pdf-cache--initialize puthash assq-delete-all gethash] 11 (#$ . 1478)]) #@220 Get value of KEY in the cache of PAGE. Returns a cons (HIT . VALUE), where HIT is non-nil if KEY was stored previously for PAGE and VALUE it's value. Otherwise HIT is nil and VALUE undefined. (fn KEY &optional PAGE) (defalias 'pdf-cache--data-get #[513 "\301 \210\302\"\236\211\203\303AB\207\304C\207" [pdf-cache--data pdf-cache--initialize gethash t nil] 6 (#$ . 1746)]) #@27 (fn KEY &optional PAGE) (defalias 'pdf-cache--data-clear #[513 "\301 \210\302\303\304\"\"#\210\305\207" [pdf-cache--data pdf-cache--initialize puthash assq-delete-all gethash nil] 9 (#$ . 2133)]) #@20 (fn &rest PAGES) (defalias 'pdf-cache-clear-data-of-pages #[128 "\205\211\211\205\211@\301\"\210A\266\202\202\262\207" [pdf-cache--data remhash] 6 (#$ . 2342)]) (defalias 'pdf-cache-clear-data #[0 "\205\301!\207" [pdf-cache--data clrhash] 2 nil nil]) #@375 Define a simple data cache function. COMMAND is the name of the command, e.g. number-of-pages. It should have a corresponding pdf-info function. If PAGE-ARG-P is non-nil, define a one-dimensional cache indexed by the page number. Otherwise the value is constant for each document, like e.g. number-of-pages. Both args are unevaluated. (fn COMMAND &optional PAGE-ARG-P) (defalias 'define-pdf-cache-function '(macro . #[513 "\211\205\300C\301\302\303\"!\301\302\304\"!\302\305\"\306\307\310\311\312 D\f\205)\300EDC\313\314\315\316\312D\203@\f\300D\202C\fC\205I\300FFE\257\207" [page intern format "pdf-cache-%s" "pdf-info-%s" "Cached version of `pdf-info-%s', which see.\n\nMake sure, not to modify it's return value." defun let hit-value pdf-cache--data-get quote if (car hit-value) (cdr hit-value) pdf-cache--data-put] 19 (#$ . 2617)])) #@108 Cached version of `pdf-info-pagelinks', which see. Make sure, not to modify it's return value. (fn PAGE) (defalias 'pdf-cache-pagelinks #[257 "\300\301\"\211@\203\f\211A\207\302\301\303!#\207" [pdf-cache--data-get pagelinks pdf-cache--data-put pdf-info-pagelinks] 6 (#$ . 3491)]) #@103 Cached version of `pdf-info-number-of-pages', which see. Make sure, not to modify it's return value. (defalias 'pdf-cache-number-of-pages #[0 "\300\301\302\"\211@\203\f\211A\207\303\301\304 \302#\207" [pdf-cache--data-get number-of-pages nil pdf-cache--data-put pdf-info-number-of-pages] 5 (#$ . 3784)]) #@110 Cached version of `pdf-info-boundingbox', which see. Make sure, not to modify it's return value. (fn PAGE) (defalias 'pdf-cache-boundingbox #[257 "\300\301\"\211@\203\f\211A\207\302\301\303!#\207" [pdf-cache--data-get boundingbox pdf-cache--data-put pdf-info-boundingbox] 6 (#$ . 4097)]) #@110 Cached version of `pdf-info-textregions', which see. Make sure, not to modify it's return value. (fn PAGE) (defalias 'pdf-cache-textregions #[257 "\300\301\"\211@\203\f\211A\207\302\301\303!#\207" [pdf-cache--data-get textregions pdf-cache--data-put pdf-info-textregions] 6 (#$ . 4398)]) #@107 Cached version of `pdf-info-pagesize', which see. Make sure, not to modify it's return value. (fn PAGE) (defalias 'pdf-cache-pagesize #[257 "\300\301\"\211@\203\f\211A\207\302\301\303!#\207" [pdf-cache--data-get pagesize pdf-cache--data-put pdf-info-pagesize] 6 (#$ . 4699)]) #@49 Non-nil, if the image cache should be bypassed. (defvar pdf-cache-image-inihibit nil (#$ . 4987)) (defvar pdf-cache--image-cache nil nil) (make-variable-buffer-local 'pdf-cache--image-cache) #@29 (fn PAGE WIDTH DATA HASH) (defalias 'pdf-cache--make-image '(macro . #[1028 "\300\257\207" [list] 9 (#$ . 5184)])) #@12 (fn IMG) (defalias 'pdf-cache--image/page '(macro . #[257 "\300\301E\207" [nth 0] 4 (#$ . 5312)])) #@12 (fn IMG) (defalias 'pdf-cache--image/width '(macro . #[257 "\300\301E\207" [nth 1] 4 (#$ . 5420)])) #@12 (fn IMG) (defalias 'pdf-cache--image/data '(macro . #[257 "\300\301E\207" [nth 2] 4 (#$ . 5529)])) #@12 (fn IMG) (defalias 'pdf-cache--image/hash '(macro . #[257 "\300\301E\207" [nth 3] 4 (#$ . 5637)])) #@294 Match IMAGE with specs. IMAGE should be a list as created by `pdf-cache--make-image'. Return non-nil, if IMAGE's page is the same as PAGE, it's width is at least MIN-WIDTH and at most MAX-WIDTH and it's stored hash-value is `eql' to HASH. (fn IMAGE PAGE MIN-WIDTH &optional MAX-WIDTH HASH) (defalias 'pdf-cache--image-match #[1283 "@U\205&\203A@Y\205&\203A@X\205&\300\3018\"\207" [eql 3] 8 (#$ . 5746)]) #@158 Return PAGE's cached PNG data as a string or nil. Does not modify the cache. See also `pdf-cache-get-image'. (fn PAGE MIN-WIDTH &optional MAX-WIDTH HASH) (defalias 'pdf-cache-lookup-image #[1026 "\301F\302\303$@\211\205\3048\207" [pdf-cache--image-cache cl-member :test #[514 "\300\301#\207" [apply pdf-cache--image-match] 6 "\n\n(fn SPEC IMAGE)"] 2] 9 (#$ . 6178)]) #@271 Return PAGE's PNG data as a string. Return an image of at least MIN-WIDTH and, if non-nil, maximum width MAX-WIDTH and `eql' hash value. Remember that image was recently used. Returns nil, if no matching image was found. (fn PAGE MIN-WIDTH &optional MAX-WIDTH HASH) (defalias 'pdf-cache-get-image #[1026 "\301B\301A\203 \302A@%\204 A\262\202A@\262@\2030\211AA\241\210\211\205;\211B\3038\207" [pdf-cache--image-cache nil pdf-cache--image-match 2] 12 (#$ . 6565)]) #@266 Cache image of PAGE with WIDTH, DATA and HASH. DATA should the string of a PNG image of width WIDTH and from page PAGE in the current buffer. See `pdf-cache-get-image' for the HASH argument. This function always returns nil. (fn PAGE WIDTH DATA &optional HASH) (defalias 'pdf-cache-put-image #[1027 "\204\302\303\304\305\306$\210\302\307\310\305\306$\210FB\211G V\2033 \311V\2031 S\233\305\241\210\2023\305\305\207" [pdf-cache--image-cache pdf-cache-image-limit add-hook pdf-info-close-document-hook pdf-cache-clear-images nil t pdf-annot-modified-functions pdf-cache--clear-images-of-annotations 1] 10 (#$ . 7065)]) #@24 Clear the image cache. (defalias 'pdf-cache-clear-images #[0 "\301\211\207" [pdf-cache--image-cache nil] 2 (#$ . 7706)]) #@199 Remove images from the cache according to FN. FN should be function accepting 4 Arguments (PAGE WIDTH DATA HASH). It should return non-nil, if the image should be removed from the cache. (fn FN) (defalias 'pdf-cache-clear-images-if #[257 "\301\302\303\"\"\211\207" [pdf-cache--image-cache cl-remove-if make-closure #[257 "\300@A@\3018\3028$\207" [V0 2 3] 7 "\n\n(fn IMAGE)"]] 5 (#$ . 7835)]) #@11 (fn FN) (defalias 'pdf-cache--clear-images-of-annotations #[257 "\300\301\302\303\304!\"\"\207" [apply pdf-cache-clear-images-of-pages mapcar #[257 "\300\236A\207" [page] 3 "\n\n(fn A)"] t] 7 (#$ . 8243)]) #@20 (fn &rest PAGES) (defalias 'pdf-cache-clear-images-of-pages #[128 "\300\301\302\"!\207" [pdf-cache-clear-images-if make-closure #[385 "\300>\207" [V0] 4 "\n\n(fn PAGE &rest _)"]] 5 (#$ . 8459)]) #@308 Render PAGE according to MIN-WIDTH and MAX-WIDTH. Return the PNG data of an image as a string, such that it's width is at least MIN-WIDTH and, if non-nil, at most MAX-WIDTH. If such an image is not available in the cache, call `pdf-info-renderpage' to create one. (fn PAGE MIN-WIDTH &optional MAX-WIDTH) (defalias 'pdf-cache-renderpage #[770 "\203 \301\"\207\302#\206\301\"\303#\210\211\262\207" [pdf-cache-image-inihibit pdf-info-renderpage pdf-cache-get-image pdf-cache-put-image] 8 (#$ . 8665)]) #@182 Render PAGE according to WIDTH, SINGLE-LINE-P and SELECTION. See also `pdf-info-renderpage-text-regions' and `pdf-cache-renderpage'. (fn PAGE WIDTH SINGLE-LINE-P &rest SELECTION) (defalias 'pdf-cache-renderpage-text-regions #[899 "\203\301\302\303&\207\304\305\306\307BB\"!\310\211$\206;\301\302\303&\311$\210\211\262\207" [pdf-cache-image-inihibit apply pdf-info-renderpage-text-regions nil sxhash format "%S" renderpage-text-regions pdf-cache-get-image pdf-cache-put-image] 12 (#$ . 9189)]) #@149 Highlight PAGE according to WIDTH and REGIONS. See also `pdf-info-renderpage-highlight' and `pdf-cache-renderpage'. (fn PAGE WIDTH &rest REGIONS) (defalias 'pdf-cache-renderpage-highlight #[642 "\203\f\301\302\303%\207\304\305\306\307B\"!\310\211$\206/\301\302\303%\311$\210\211\262\207" [pdf-cache-image-inihibit apply pdf-info-renderpage-highlight nil sxhash format "%S" renderpage-highlight pdf-cache-get-image pdf-cache-put-image] 10 (#$ . 9722)]) #@25 Pages to be prefetched. (defvar pdf-cache--prefetch-pages nil (#$ . 10201)) (make-variable-buffer-local 'pdf-cache--prefetch-pages) #@37 Timer used when prefetching images. (defvar pdf-cache--prefetch-timer nil (#$ . 10339)) (make-variable-buffer-local 'pdf-cache--prefetch-timer) #@127 Non-nil if Pdf-Cache-Prefetch minor mode is enabled. Use the command `pdf-cache-prefetch-minor-mode' to change this variable. (defvar pdf-cache-prefetch-minor-mode nil (#$ . 10490)) (make-variable-buffer-local 'pdf-cache-prefetch-minor-mode) #@644 Try to load images which will probably be needed in a while. This is a minor mode. If called interactively, toggle the `Pdf-Cache-Prefetch minor mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `pdf-cache-prefetch-minor-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'pdf-cache-prefetch-minor-mode #[256 "\304 \305=\203 ?\202\247\203\306W\203\307\202\310\311\301!\2031\312\300 \"\2031\300 B\313 \210\203P\314 \210\315\316\317\307\310$\210\320\n\206H\306\310\321p$\202V\322\316\317\310#\210\323\324\203`\325\202a\326\"\210\327\330!\203\203\304 \203u\211\304 \232\203\203\331\332\203\333\202\200\334\335#\210\210\336 \210\207" [pdf-cache-prefetch-minor-mode local-minor-modes pdf-cache-prefetch-delay pdf-cache--prefetch-timer current-message toggle 1 nil t boundp delq pdf-cache--prefetch-cancel pdf-util-assert-pdf-buffer add-hook pre-command-hook pdf-cache--prefetch-stop run-with-idle-timer pdf-cache--prefetch-start remove-hook run-hooks pdf-cache-prefetch-minor-mode-hook pdf-cache-prefetch-minor-mode-on-hook pdf-cache-prefetch-minor-mode-off-hook called-interactively-p any message "Pdf-Cache-Prefetch minor mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 7 (#$ . 10739) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar pdf-cache-prefetch-minor-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\302\300\304\305#\210\302\300\306\307C#\210\310\311\307\312\307\211%\207" [pdf-cache-prefetch-minor-mode-hook variable-documentation put "Hook run after entering or leaving `pdf-cache-prefetch-minor-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode pdf-cache-prefetch-minor-mode t] 6) (defalias 'pdf-cache-prefetch-pages-function-default #[0 "\300\301\302\"C\303\304\305\306\307C\307C\310\311\312 $\313\307\314\"\"\266\202\307\315 D\310\316\317\301\"\304\320\321\300\301\302\"!\"\"#\"!\207" [image-mode-window-get page nil pdf-util-remove-duplicates cl-remove-if-not #[257 "\211\300Y\205\n\211\301 X\207" [1 pdf-cache-number-of-pages] 3 "\n\n(fn PAGE)"] append 1 mapcar make-closure #[257 "\300\211\242\301\242\302\242_\\\240\210\301\211\242[\240\210\302\211\242T\240\210\300\242\207" [V0 V1 V2] 5 "\n\n(fn _)"] number-sequence 16 pdf-cache-number-of-pages apply-partially alist-get #[257 "\300\301\"\302=\207" [alist-get type goto-dest] 4 "\n\n(fn LINK)"] pdf-cache-pagelinks] 15]) #@27 (fn WINDOW IMAGE-WIDTH) (defalias 'pdf-cache--prefetch-pages #[514 "\303 =\205u\304 \205u\211A\242C\211\242\2036\305\242\306 \204$\202'\307_#\2036\211\211A\242\240\210\202\310\301!\203I \203I\211\242\204I\311\312!\210\211\242\205sp\313\314%\3151d\316\242\"0\202p\317\320!\210\321@A\"\262)\262\262\207" [pdf-cache--prefetch-pages pdf-tools-debug pdf-info-asynchronous selected-window pdf-util-pdf-buffer-p pdf-cache-lookup-image pdf-view-use-scaling-p 2 boundp message "Prefetching done." make-closure #[514 "?\205D\300\305 =\205D\303\306 =\205Dr\306 q\210\307\310!\205C\311\302\242\301#\210\312\313\302\242!!\210\314\304!\203<\f\203<\315\316\302\242\"\210\317\320\321\322\300\301%)\207" [V0 V1 V2 V3 pdf-tools-debug selected-window window-buffer derived-mode-p pdf-view-mode pdf-cache-put-image image-size pdf-view-create-page boundp message "Prefetched page %s." run-with-timer 0.001 nil pdf-cache--prefetch-pages] 8 "\n\n(fn STATUS DATA)"] (error) pdf-info-renderpage pdf-cache-prefetch-minor-mode -1 signal] 10 (#$ . 13685)]) #@86 Guard against multiple prefetch starts. Used solely in `pdf-cache--prefetch-start'. (defvar pdf-cache--prefetch-started-p nil (#$ . 14765)) #@50 Start prefetching images in BUFFER. (fn BUFFER) (defalias 'pdf-cache--prefetch-start #[257 "\205= ?\205=\306 \205=\n?\205= ?\205=\307 =\205=\310\f!\205=\311\f \312\313G Z]\"\303\314 \315 @\")\262\207" [pdf-cache-prefetch-minor-mode pdf-cache--prefetch-started-p isearch-mode pdf-cache--prefetch-pages pdf-cache-prefetch-pages-function pdf-cache-image-limit pdf-util-pdf-buffer-p window-buffer fboundp t butlast 0 selected-window pdf-view-desired-image-size] 7 (#$ . 14912)]) #@44 Stop prefetching images in current buffer. (defalias 'pdf-cache--prefetch-stop #[0 "\301\211\207" [pdf-cache--prefetch-pages nil] 2 (#$ . 15408)]) #@46 Cancel prefetching images in current buffer. (defalias 'pdf-cache--prefetch-cancel #[0 "\301 \210\203 \302!\210\303\211\207" [pdf-cache--prefetch-timer pdf-cache--prefetch-stop cancel-timer nil] 2 (#$ . 15562)]) (provide 'pdf-cache)