Function: pdf-cache-prefetch-minor-mode

pdf-cache-prefetch-minor-mode is an interactive and natively compiled function defined in pdf-cache.el.

Signature

(pdf-cache-prefetch-minor-mode &optional ARG)

Documentation

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 the variable pdf-cache-prefetch-minor-mode(var)/pdf-cache-prefetch-minor-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-cache.el
(define-minor-mode pdf-cache-prefetch-minor-mode
  "Try to load images which will probably be needed in a while."
  :group 'pdf-cache
  (pdf-cache--prefetch-cancel)
  (cond
   (pdf-cache-prefetch-minor-mode
    (pdf-util-assert-pdf-buffer)
    (add-hook 'pre-command-hook #'pdf-cache--prefetch-stop nil t)
    ;; FIXME: Disable the time when the buffer is killed or its
    ;; major-mode changes.
    (setq pdf-cache--prefetch-timer
          (run-with-idle-timer (or pdf-cache-prefetch-delay 1) t
                               #'pdf-cache--prefetch-start (current-buffer))))
   (t
    (remove-hook 'pre-command-hook #'pdf-cache--prefetch-stop t))))