diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 82da62e23..942d1d40b 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -1416,7 +1416,7 @@ When CLEAR-ENTIRE-CACHE is non-nil (interactively set by \\[universal-argument]) the *entire* preview cache will be cleared, and `org-persist-gc' run." (interactive (if current-prefix-arg - '(nil nil t) + (list nil nil (y-or-n-p "This will clear the systemwide LaTeX preview cache, continue? ")) (let ((context (if (derived-mode-p 'org-mode) (org-element-context) (user-error "This command must be run in an org-mode buffer")))) @@ -1427,7 +1427,7 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." '(latex-fragment latex-environment)) (list (org-element-property :begin context) (org-element-property :end context))) - (t (list (point-min) (point-max))))))) + (t (list nil nil)))))) (org-latex-preview-clear-overlays beg end) (if clear-entire-cache (let ((n 0)) @@ -1441,10 +1441,11 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." (message "The Org LaTeX preview cache was already empty.") (org-persist-gc) (message "Cleared all %d entries fom the Org LaTeX preview cache." n))) - (let* ((imagetype (or (plist-get (alist-get org-latex-preview-default-process - org-latex-preview-process-alist) - :image-output-type) - "png"))) + (let ((imagetype + (or (plist-get (alist-get org-latex-preview-default-process + org-latex-preview-process-alist) + :image-output-type) + "png"))) (dolist (element (org-latex-preview-collect-fragments beg end)) (pcase-let* ((begin (org-element-property :begin element)) (`(,fg ,bg) (org-latex-preview--colors-at begin)) @@ -1452,9 +1453,9 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." (org-latex-preview--remove-cached (org-latex-preview--hash org-latex-preview-default-process - value - imagetype - fg bg))))))) + value imagetype fg bg)))) + (message "Cleared LaTeX preview cache for %s." + (if (or beg end) "region" "buffer"))))) ;; TODO: Switching processes from imagemagick to dvi* with an existing ;; dump-file during a single Emacs session should trigger