org-latex-preview: Adjust customisation scheme

* lisp/org-latex-preview.el (org-latex-preview-live--teardown,
org-latex-preview-live--setup, org-latex-preview-live--src-buffer-setup,
org-latex-preview-live--ensure-overlay, org-latex-preview-throttle,
org-latex-preview-debounce, org-latex-preview-live-preview-inline,
org-latex-preview-auto--open-this-overlay,
org-latex-preview-auto--detect-fragments-in-change,
org-latex-preview-auto--handle-post-cursor,
org-latex-preview--face-around, org-latex-preview-auto-generate,
org-latex-preview-auto-blacklist, org-latex-preview-clear-cache,
org-latex-preview--latex-preview-filter,
org-latex-preview--create-tex-file,
org-latex-preview--create-image-async, org-latex-preview--hash,
org-latex-preview--auto-aware-toggle, org-latex-preview--preview-region,
org-latex-preview-live--teardown, org-latex-preview-live--setup,
org-latex-preview-live--src-buffer-setup,
org-latex-preview-live--ensure-overlay,
org-latex-preview-auto--regenerate-overlay,
org-latex-preview-auto--close-previous-overlay,
org-latex-preview-auto--open-this-overlay,
org-latex-preview-auto--detect-fragments-in-change,
org-latex-preview--update-overlay,
org-latex-preview--indicate-processing, org-latex-preview-precompile,
org-latex-preview-open-functions, org-latex-preview-close-functions,
org-latex-preview-update-overlay-functions,
org-latex-preview-auto-command-blacklist,
org-latex-preview-processing-indicator,
org-latex-preview-default-process): Change the customisation naming
scheme to be more consistent.

* testing/lisp/test-org-latex-preview.el: Change the LaTeX preview
customisation naming scheme to be more consistent.

* lisp/org-compat.el: Change the LaTeX preview customisation naming
scheme to be more consistent.

* etc/ORG-NEWS: Change the LaTeX preview customisation naming scheme to
be more consistent.

* doc/org-manual.org (Footnotes, Previewing LaTeX fragments): Change the
LaTeX preview customisation naming scheme to be more consistent.
This commit is contained in:
TEC 2024-01-07 15:43:47 +08:00
parent 5b7254440f
commit d62e49f45f
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
5 changed files with 133 additions and 120 deletions

View File

@ -11421,7 +11421,7 @@ lines:
:END: :END:
#+cindex: @LaTeX{} fragments, preview #+cindex: @LaTeX{} fragments, preview
#+vindex: org-latex-preview-default-process #+vindex: org-latex-preview-process-default
If you have a working LaTeX installation and =dvipng=, =dvisvgm= or If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
=convert= installed[fn:38], LaTeX fragments can be processed to =convert= installed[fn:38], LaTeX fragments can be processed to
produce images of the typeset expressions to be used for inclusion produce images of the typeset expressions to be used for inclusion
@ -23524,7 +23524,7 @@ used to create images, any LaTeX environment is handled.
[fn:38] These are respectively available at [fn:38] These are respectively available at
[[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]] [[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
and from the ImageMagick suite. Choose the converter by setting the and from the ImageMagick suite. Choose the converter by setting the
variable ~org-latex-preview-default-process~ accordingly. variable ~org-latex-preview-process-default~ accordingly.
[fn:39] This works automatically for the HTML backend (it requires [fn:39] This works automatically for the HTML backend (it requires
version 1.34 of the =htmlize.el= package, which you need to install). version 1.34 of the =htmlize.el= package, which you need to install).

View File

@ -526,7 +526,7 @@ Org mode's LaTeX preview system has been rewritten with several improvements and
When this mode is turned on, LaTeX preview overlays in the buffer can be temporarily disabled by moving the cursor into them. Moving the cursor out will display the LaTeX preview image overlay again. Additionally, editing LaTeX fragments that have previews will cause the preview images to be updated. When this mode is turned on, LaTeX preview overlays in the buffer can be temporarily disabled by moving the cursor into them. Moving the cursor out will display the LaTeX preview image overlay again. Additionally, editing LaTeX fragments that have previews will cause the preview images to be updated.
If the option ~org-latex-preview-auto-generate~ is non-nil (which see), previews for LaTeX fragments will be auto-generated as you type. If the option ~org-latex-preview-auto-track-inserts~ is non-nil (which see), previews for LaTeX fragments will be auto-generated as you type.
**** New options **** New options
@ -547,7 +547,7 @@ This is the number of days for which LaTeX preview images will be
cached, assuming persistence is turned on with cached, assuming persistence is turned on with
~org-latex-preview-persist~. ~org-latex-preview-persist~.
***** New option ~org-latex-preview-processing-indicator~ to indicate preview processing for LaTeX fragments ***** New option ~org-latex-preview-process-active-indicator~ to indicate preview processing for LaTeX fragments
This option controls the style of visual indicator for LaTeX fragments This option controls the style of visual indicator for LaTeX fragments
currently being processed. currently being processed.
@ -563,14 +563,14 @@ This option controls the width of text in preview images. This is
relevant for displaymath-type LaTeX environments, and can be specified relevant for displaymath-type LaTeX environments, and can be specified
in multiple ways. in multiple ways.
***** New option ~org-latex-preview-precompile~ to control LaTeX precompilation ***** New option ~org-latex-preview-process-precompiled~ to control LaTeX precompilation
This option controls whether LaTeX headers for buffers are precompiled This option controls whether LaTeX headers for buffers are precompiled
when generating the first preview for the buffer. Precompilation can when generating the first preview for the buffer. Precompilation can
speed up preview generation by a moderate to large amount depending on speed up preview generation by a moderate to large amount depending on
the complexity of the header. the complexity of the header.
***** New option ~org-latex-preview-auto-generate~ to auto-generate LaTeX previews when typing ***** New option ~org-latex-preview-auto-track-inserts~ to auto-generate LaTeX previews when typing
When using ~org-latex-preview-auto-mode~ (which see), setting this option to a non-nil value will cause LaTeX previews to be rendered as you type LaTeX fragments. This works however new text is added to the buffer, for example by yanking. When this option is nil and ~org-latex-preview-auto-mode~ is on, existing previews for LaTeX fragments will still be auto-regenerated when edited but no new ones will be auto-generated. When using ~org-latex-preview-auto-mode~ (which see), setting this option to a non-nil value will cause LaTeX previews to be rendered as you type LaTeX fragments. This works however new text is added to the buffer, for example by yanking. When this option is nil and ~org-latex-preview-auto-mode~ is on, existing previews for LaTeX fragments will still be auto-regenerated when edited but no new ones will be auto-generated.
@ -594,7 +594,7 @@ behaves the exact same way and is renamed for consistency.
***** Mark ~org-preview-latex-default-process~ obsolete ***** Mark ~org-preview-latex-default-process~ obsolete
Use ~org-latex-preview-default-process~ instead. The replacement Use ~org-latex-preview-process-default~ instead. The replacement
variable behaves the exact same way and is renamed for consistency. variable behaves the exact same way and is renamed for consistency.
***** Mark ~org-preview-latex-process-alist~ obsolete ***** Mark ~org-preview-latex-process-alist~ obsolete

View File

@ -674,7 +674,7 @@ This constant, for example, makes the below code not err:
(define-obsolete-variable-alias (define-obsolete-variable-alias
'org-format-latex-header 'org-latex-preview-preamble "9.7") 'org-format-latex-header 'org-latex-preview-preamble "9.7")
(define-obsolete-variable-alias (define-obsolete-variable-alias
'org-preview-latex-default-process 'org-latex-preview-default-process "9.7") 'org-preview-latex-default-process 'org-latex-preview-process-default "9.7")
(define-obsolete-variable-alias (define-obsolete-variable-alias
'org-preview-latex-process-alist 'org-latex-preview-process-alist "9.7") 'org-preview-latex-process-alist 'org-latex-preview-process-alist "9.7")
(define-obsolete-function-alias (define-obsolete-function-alias

View File

@ -78,7 +78,7 @@ This is a property list with the following properties:
:package-version '(Org . "9.7") :package-version '(Org . "9.7")
:type 'plist) :type 'plist)
(defcustom org-latex-preview-default-process (defcustom org-latex-preview-process-default
(if (executable-find "dvisvgm") 'dvisvgm 'dvipng) (if (executable-find "dvisvgm") 'dvisvgm 'dvipng)
"The default process to convert LaTeX fragments to image files. "The default process to convert LaTeX fragments to image files.
All available processes and theirs documents can be found in All available processes and theirs documents can be found in
@ -213,7 +213,7 @@ This is only relevant when `org-latex-preview-persist' is non-nil."
(number :tag "Keep N days") (number :tag "Keep N days")
(function :tag "Function"))) (function :tag "Function")))
(defcustom org-latex-preview-numbered nil (defcustom org-latex-preview-numbered t
"Whether to calculate and apply correct equation numbering. "Whether to calculate and apply correct equation numbering.
When nil, equation numbering is disabled and a diamond symbol is When nil, equation numbering is disabled and a diamond symbol is
shown in place of the equation number. shown in place of the equation number.
@ -230,7 +230,7 @@ or mostly-incorrect depending on the situation."
(const :tag "Preview " preview) (const :tag "Preview " preview)
(const :tag "Yes" t))) (const :tag "Yes" t)))
(defcustom org-latex-preview-processing-indicator 'fringe (defcustom org-latex-preview-process-active-indicator 'fringe
"The style of visual indicator for LaTeX currently being processed. "The style of visual indicator for LaTeX currently being processed.
This sets the method used to indicated that a LaTeX fragment is This sets the method used to indicated that a LaTeX fragment is
currently being processed for display. currently being processed for display.
@ -249,7 +249,7 @@ There are three recognised value symbols:
(const :tag "Fringe marker" fringe) (const :tag "Fringe marker" fringe)
(const :tag "Processing face" face))) (const :tag "Processing face" face)))
(defcustom org-latex-preview-auto-blacklist nil (defcustom org-latex-preview-auto-ignored-commands nil
"List of movement commands that should not affect preview display. "List of movement commands that should not affect preview display.
When these commands are invoked, they will not cause previews to When these commands are invoked, they will not cause previews to
@ -279,7 +279,7 @@ processing after the LaTeX preview process."
:group 'org-latex-preview :group 'org-latex-preview
:type 'hook) :type 'hook)
(defcustom org-latex-preview-update-overlay-functions nil (defcustom org-latex-preview-overlay-update-functions nil
"Abnormal hook run after a preview-overlay is updated. "Abnormal hook run after a preview-overlay is updated.
Each function in this hook is called with one argument, the Each function in this hook is called with one argument, the
@ -287,7 +287,7 @@ overlay that was updated."
:group 'org-latex-preview :group 'org-latex-preview
:type 'hook) :type 'hook)
(defcustom org-latex-preview-close-functions nil (defcustom org-latex-preview-overlay-close-functions nil
"Abnormal hook run after placing a LaTeX preview image. "Abnormal hook run after placing a LaTeX preview image.
This hook typically runs when the cursor is moved out of a LaTeX This hook typically runs when the cursor is moved out of a LaTeX
@ -300,7 +300,7 @@ that the cursor moved out of."
:group 'org-latex-preview :group 'org-latex-preview
:type 'hook) :type 'hook)
(defcustom org-latex-preview-open-functions nil (defcustom org-latex-preview-overlay-open-functions nil
"Hook run after hiding a LaTeX preview image. "Hook run after hiding a LaTeX preview image.
This hook typically runs when the cursor is moved into a LaTeX This hook typically runs when the cursor is moved into a LaTeX
@ -316,7 +316,7 @@ that the cursor moved into."
(defface org-latex-preview-processing-face '((t :inherit shadow)) (defface org-latex-preview-processing-face '((t :inherit shadow))
"Face applied to LaTeX fragments for which a preview is being generated. "Face applied to LaTeX fragments for which a preview is being generated.
See `org-latex-preview-processing-indicator'." See `org-latex-preview-process-active-indicator'."
:group 'org-faces) :group 'org-faces)
(defconst org-latex-preview--image-log "*Org Preview Convert Output*" (defconst org-latex-preview--image-log "*Org Preview Convert Output*"
@ -339,7 +339,7 @@ header, or they will be appended."
:group 'org-latex-preview :group 'org-latex-preview
:type 'string) :type 'string)
(defcustom org-latex-preview-precompile t (defcustom org-latex-preview-process-precompiled t
"Use LaTeX header precompilation when previewing fragments. "Use LaTeX header precompilation when previewing fragments.
This causes a slight delay the first time `org-latex-pdf-process' This causes a slight delay the first time `org-latex-pdf-process'
is called in a buffer, but subsequent calls will be faster. is called in a buffer, but subsequent calls will be faster.
@ -349,8 +349,8 @@ This requires the LaTeX package \"mylatexformat\" to be installed."
:package-version '(Org . "9.7") :package-version '(Org . "9.7")
:type 'boolean) :type 'boolean)
(defcustom org-latex-preview-auto-generate t (defcustom org-latex-preview-auto-track-inserts t
"Whether `org-latex-preview-auto-mode' should apply to new and edited fragments. "Whether `org-latex-preview-auto-mode' should apply to newly inserted fragments.
When `org-latex-preview-auto-mode' is on, existing LaTeX previews When `org-latex-preview-auto-mode' is on, existing LaTeX previews
will be automatically hidden/shown on cursor movement and will be automatically hidden/shown on cursor movement and
@ -363,19 +363,13 @@ The following values are supported:
- nil: Do not generate previews for newly inserted fragments. - nil: Do not generate previews for newly inserted fragments.
- live: (symbol) same as t, but also update previews for existing
fragments continuously with each keystroke. These live
previews are shown according to
`org-latex-preview-live-display-type', which see.
Note that existing previews are always updated after the cursor Note that existing previews are always updated after the cursor
moves out of them." moves out of them."
:group 'org-latex :group 'org-latex
:package-version '(Org . "9.7") :package-version '(Org . "9.7")
:type '(choice :type '(choice
(const :tag "Auto-generate" t) (const :tag "Track inserts" t)
(const :tag "Don't auto-generate" nil) (const :tag "Don't track inserts" nil)))
(const :tag "Auto-generate continuously" live)))
(defconst org-latex-preview--tentative-math-re (defconst org-latex-preview--tentative-math-re
"\\$\\|\\\\[([]\\|^[ \t]*\\\\begin{[A-Za-z0-9*]+}" "\\$\\|\\\\[([]\\|^[ \t]*\\\\begin{[A-Za-z0-9*]+}"
@ -442,12 +436,12 @@ the image.")
(defun org-latex-preview--indicate-processing (ov &optional on) (defun org-latex-preview--indicate-processing (ov &optional on)
"Modify OV to provide visual indication of LaTeX fragment preview generation. "Modify OV to provide visual indication of LaTeX fragment preview generation.
When `org-latex-preview-processing-indicator' is set to fringe, a When `org-latex-preview-process-active-indicator' is set to fringe, a
triangle in the left fringe will be shown or hidden depending on ON. triangle in the left fringe will be shown or hidden depending on ON.
When `org-latex-preview-processing-indicator' is set to face, the When `org-latex-preview-process-active-indicator' is set to face, the
overlay face is set to `org-latex-preview-processing-face'." overlay face is set to `org-latex-preview-processing-face'."
(pcase org-latex-preview-processing-indicator (pcase org-latex-preview-process-active-indicator
('fringe ('fringe
(overlay-put (overlay-put
ov 'before-string ov 'before-string
@ -507,7 +501,7 @@ overlay face is set to `org-latex-preview-processing-face'."
ov 'before-string ov 'before-string
(propertize "!" 'display (propertize "!" 'display
`(left-fringe exclamation-mark error))))) `(left-fringe exclamation-mark error)))))
(when org-latex-preview-processing-indicator (when org-latex-preview-process-active-indicator
(org-latex-preview--indicate-processing ov)) (org-latex-preview--indicate-processing ov))
;; This is a temporary measure until a more sophisticated ;; This is a temporary measure until a more sophisticated
;; interface for errors is available in Org. ;; interface for errors is available in Org.
@ -521,7 +515,7 @@ overlay face is set to `org-latex-preview-processing-face'."
(unless (overlay-get ov 'view-text) ;Live previewing this element, update in background (unless (overlay-get ov 'view-text) ;Live previewing this element, update in background
(when image-display (overlay-put ov 'display image-display)) (when image-display (overlay-put ov 'display image-display))
(overlay-put ov 'face (overlay-get ov 'hidden-face))) (overlay-put ov 'face (overlay-get ov 'hidden-face)))
(run-hook-with-args 'org-latex-preview-update-overlay-functions ov))) (run-hook-with-args 'org-latex-preview-overlay-update-functions ov)))
(defun org-latex-preview--face-around (start end) (defun org-latex-preview--face-around (start end)
"Return the relevant face symbol(s) around the region START to END. "Return the relevant face symbol(s) around the region START to END.
@ -578,7 +572,7 @@ Faces in `org-latex-preview--ignored-faces' are ignored."
;; `preview-state', and the function ;; `preview-state', and the function
;; `org-latex-preview-auto--close-previous-overlay' handles the recompilation. ;; `org-latex-preview-auto--close-previous-overlay' handles the recompilation.
;; ;;
;; When the user option `org-latex-preview-auto-generate' is ;; When the user option `org-latex-preview-auto-track-inserts' is
;; non-nil, previews are auto-generated for latex fragments as they ;; non-nil, previews are auto-generated for latex fragments as they
;; are inserted into the buffer. This work is handled by ;; are inserted into the buffer. This work is handled by
;; `org-latex-preview-auto--detect-fragments-in-change', which is added to ;; `org-latex-preview-auto--detect-fragments-in-change', which is added to
@ -623,8 +617,6 @@ display the underlying latex fragment. If the cursor is moving
out of a preview overlay, show the image again or generate a new out of a preview overlay, show the image again or generate a new
one as appropriate. one as appropriate.
See `org-latex-preview-auto-generate' to customize this behavior.
This is intended to be placed in `post-command-hook'." This is intended to be placed in `post-command-hook'."
(let ((into-overlay-p (eq (get-char-property (point) 'org-overlay-type) (let ((into-overlay-p (eq (get-char-property (point) 'org-overlay-type)
'org-latex-overlay))) 'org-latex-overlay)))
@ -643,8 +635,11 @@ This is intended to be placed in `post-command-hook'."
(set-marker org-latex-preview-auto--marker (point)))) (set-marker org-latex-preview-auto--marker (point))))
(defun org-latex-preview-auto--detect-fragments-in-change (beg end _) (defun org-latex-preview-auto--detect-fragments-in-change (beg end _)
"Examine the content between BEG and END, and preview LaTeX fragments found." "Examine the content between BEG and END, and preview LaTeX fragments found.
(when org-latex-preview-auto-generate This is only active when either
`org-latex-preview-auto-track-inserts' or
`org-latex-preview-live' is enabled."
(when (or org-latex-preview-auto-track-inserts org-latex-preview-live)
(let ((initial-point (point)) (let ((initial-point (point))
fragments) fragments)
(save-excursion (save-excursion
@ -701,7 +696,7 @@ This is intended to be placed in `post-command-hook'."
(org-latex-preview--get-numbered-environments (org-latex-preview--get-numbered-environments
end nil)))) end nil))))
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process org-latex-preview-process-default
fragments))))) fragments)))))
(defun org-latex-preview-auto--maybe-track-element-here (type pos) (defun org-latex-preview-auto--maybe-track-element-here (type pos)
@ -743,7 +738,7 @@ image and display its text."
(when (and (eq (overlay-get ov 'org-overlay-type) (when (and (eq (overlay-get ov 'org-overlay-type)
'org-latex-overlay) 'org-latex-overlay)
(not (memq this-command (not (memq this-command
org-latex-preview-auto-blacklist))) org-latex-preview-auto-ignored-commands)))
(overlay-put ov 'display nil) (overlay-put ov 'display nil)
(overlay-put ov 'view-text t) (overlay-put ov 'view-text t)
(when-let ((f (overlay-get ov 'face))) (when-let ((f (overlay-get ov 'face)))
@ -751,7 +746,7 @@ image and display its text."
(overlay-put ov 'face nil)) (overlay-put ov 'face nil))
(org-latex-preview-auto--move-into ov) (org-latex-preview-auto--move-into ov)
(setq org-latex-preview-auto--from-overlay nil) (setq org-latex-preview-auto--from-overlay nil)
(run-hook-with-args 'org-latex-preview-open-functions ov)))) (run-hook-with-args 'org-latex-preview-overlay-open-functions ov))))
(defun org-latex-preview-auto--close-previous-overlay () (defun org-latex-preview-auto--close-previous-overlay ()
"Close Org latex preview image overlays. "Close Org latex preview image overlays.
@ -775,7 +770,7 @@ image. The preview image is regenerated if necessary."
(overlay-put ov 'face f)) (overlay-put ov 'face f))
(overlay-put ov 'hidden-face nil)) (overlay-put ov 'hidden-face nil))
(overlay-put ov 'display (overlay-get ov 'preview-image))) (overlay-put ov 'display (overlay-get ov 'preview-image)))
(run-hook-with-args 'org-latex-preview-close-functions ov)))) (run-hook-with-args 'org-latex-preview-overlay-close-functions ov))))
(defun org-latex-preview-auto--regenerate-overlay (ov) (defun org-latex-preview-auto--regenerate-overlay (ov)
"Regenerate the LaTeX fragment under overlay OV." "Regenerate the LaTeX fragment under overlay OV."
@ -790,12 +785,12 @@ image. The preview image is regenerated if necessary."
(if (memq (org-element-type fragment) (if (memq (org-element-type fragment)
'(latex-fragment latex-environment)) '(latex-fragment latex-environment))
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process org-latex-preview-process-default
(cons fragment others)) (cons fragment others))
(delete-overlay ov) (delete-overlay ov)
(when others (when others
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process org-latex-preview-process-default
others)))))) others))))))
(defun org-latex-preview-auto--insert-front-handler (defun org-latex-preview-auto--insert-front-handler
@ -828,13 +823,17 @@ manual: (elisp) Overlay Properties."
(define-minor-mode org-latex-preview-auto-mode (define-minor-mode org-latex-preview-auto-mode
"Minor mode to automatically preview LaTeX fragments. "Minor mode to automatically preview LaTeX fragments.
When LaTeX preview auto mode is on, LaTeX fragments in Org buffers are When LaTeX preview auto mode is on, LaTeX fragments in Org
automatically previewed after being inserted, and hidden when the buffers are automatically previewed after being inserted, and
cursor moves into them. This allows one to seamlessly edit and hidden when the cursor moves into them. This allows one to
preview LaTeX in Org buffers. seamlessly edit and preview LaTeX in Org buffers.
To enable auto-toggling of the preview images without auto-generating To enable auto-toggling of the preview images without
them or vice-versa, customize the variable `org-latex-preview-auto-generate'." auto-generating them or vice-versa, customize the variable
`org-latex-preview-auto-track-inserts'.
To enable previews of LaTeX fragments while writing them,
customize the variable `org-latex-preview-live'."
:global nil :global nil
(if org-latex-preview-auto-mode (if org-latex-preview-auto-mode
(progn (progn
@ -843,7 +842,7 @@ them or vice-versa, customize the variable `org-latex-preview-auto-generate'."
(org-latex-preview-auto--handle-pre-cursor) ; Invoke setup before the hook even fires. (org-latex-preview-auto--handle-pre-cursor) ; Invoke setup before the hook even fires.
(add-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor nil 'local) (add-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor nil 'local)
(add-hook 'after-change-functions #'org-latex-preview-auto--detect-fragments-in-change nil 'local) (add-hook 'after-change-functions #'org-latex-preview-auto--detect-fragments-in-change nil 'local)
(when (eq org-latex-preview-auto-generate 'live) (when org-latex-preview-live
(org-latex-preview-live--setup))) (org-latex-preview-live--setup)))
(remove-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor 'local) (remove-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor 'local)
(remove-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor 'local) (remove-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor 'local)
@ -853,12 +852,12 @@ them or vice-versa, customize the variable `org-latex-preview-auto-generate'."
;; Code for "live" preview generation ;; Code for "live" preview generation
;; ;;
;; When `org-latex-preview-auto-mode' is turned on and ;; When `org-latex-preview-auto-mode' is turned on and
;; `org-latex-preview-auto-generate' is set to the symbol `live', ;; `org-latex-preview-live' is non-nil, previews are generated in the
;; previews are generated in the background with each change to the ;; background with each change to the LaTeX fragment being edited.
;; LaTeX fragment being edited. This continuously updated preview is ;; This continuously updated preview is shown to the right of the
;; shown to the right of the LaTeX fragment, or under the LaTeX ;; LaTeX fragment, or under the LaTeX environment being edited.
;; environment being edited. Alternatively, it can be shown using ;; Alternatively, it can be shown using Eldoc (see
;; Eldoc (see `org-latex-preview-live-display-type'). ;; `org-latex-preview-live-display-type').
;; ;;
;; The code works as follows (simplified description): ;; The code works as follows (simplified description):
@ -874,8 +873,8 @@ them or vice-versa, customize the variable `org-latex-preview-auto-generate'."
;; - When the preview is regenerated, the `after-string' property of ;; - When the preview is regenerated, the `after-string' property of
;; the preview overlay is updated to show the new image. This ;; the preview overlay is updated to show the new image. This
;; regeneration is modulated with a debounce ;; regeneration is modulated with a debounce
;; `org-latex-preview-debounce' and a throttle ;; `org-latex-preview-live-debounce' and a throttle
;; `org-latex-preview-throttle'. ;; `org-latex-preview-live-throttle'.
;; ;;
;; - When the cursor exits the boundaries of the fragment, the ;; - When the cursor exits the boundaries of the fragment, the
;; `after-string' property of the preview overlay is removed. ;; `after-string' property of the preview overlay is removed.
@ -887,18 +886,32 @@ them or vice-versa, customize the variable `org-latex-preview-auto-generate'."
(defvar-local org-latex-preview-live--generator nil) (defvar-local org-latex-preview-live--generator nil)
(defcustom org-latex-preview-live-preview-inline t (defcustom org-latex-preview-live '(block edit-special)
"Whether inline LaTeX fragments should be live-previewed along "Whether LaTeX previews should be generated during writing.
with LaTeX environments." This affects the behaviour of `org-latex-preview-auto-mode'.
:group 'org-latex-preview
:type 'boolean) It is either a boolean value (preview everything or nothing), or
a list of context symbols within which live previews should be
shown.
The availible contexts are:
- inline, for inline LaTeX fragments
- block, for LaTeX environments
- edit-special, for org-edit-special buffers"
:group 'org-latex-preview-live
:type '(choice
(const :tag "Everywhere" t)
(const :tag "Never" nil)
(set :greedy t :tag "Contexts"
(const :tag "Inline LaTeX fragments" inline)
(const :tag "LaTeX environments" block)
(const :tag "When using org-edit-special" edit-special))))
(defcustom org-latex-preview-live-display-type 'buffer (defcustom org-latex-preview-live-display-type 'buffer
"How to display live-updating previews of LaTeX snippets. "How to display live-updating previews of LaTeX snippets.
This option is meaningful when live previews are enabled, by This option is meaningful when live previews are enabled via
setting `org-latex-preview-auto-generate' to `live' and enabling `org-latex-preview-live'.
`org-latex-preview-auto-mode'.
The currently supported options are the symbols The currently supported options are the symbols
@ -914,10 +927,10 @@ The currently supported options are the symbols
(const :tag "Display next to fragment" buffer) (const :tag "Display next to fragment" buffer)
(const :tag "Display in Eldoc" eldoc))) (const :tag "Display in Eldoc" eldoc)))
(defcustom org-latex-preview-debounce 1.0 (defcustom org-latex-preview-live-debounce 1.0
"Idle time before regenerating LaTeX previews. "Idle time before regenerating LaTeX previews.
When `org-latex-preview-auto-generate' is set to `live' and When `org-latex-preview-live' is non-nil and
`org-latex-preview-auto-mode' is active, live previews are `org-latex-preview-auto-mode' is active, live previews are
updated when there have been no changes to the LaTeX fragment or updated when there have been no changes to the LaTeX fragment or
environment for at least this much time." environment for at least this much time."
@ -925,10 +938,10 @@ environment for at least this much time."
:package-version '(Org . "9.7") :package-version '(Org . "9.7")
:type 'number) :type 'number)
(defcustom org-latex-preview-throttle 1.0 (defcustom org-latex-preview-live-throttle 1.0
"Throttle time for live LaTeX previews. "Throttle time for live LaTeX previews.
When `org-latex-preview-auto-generate' is set to `live' and When `org-latex-preview-live' is non-nil and
`org-latex-preview-auto-mode' is active, live previews are `org-latex-preview-auto-mode' is active, live previews are
updated no more than once in this interval of time." updated no more than once in this interval of time."
:group 'org-latex-preview :group 'org-latex-preview
@ -1023,7 +1036,8 @@ BOX-FACE is the face to apply in addition."
(org-element-type elm))))) (org-element-type elm)))))
(eq org-latex-preview-live--element-type (eq org-latex-preview-live--element-type
'latex-environment)))) 'latex-environment))))
(when (or latex-env-p org-latex-preview-live-preview-inline) (when (or (eq org-latex-preview-live t)
(memq (if latex-env-p 'block 'inline) org-latex-preview-live))
(when (eq org-latex-preview-live-display-type 'buffer) (when (eq org-latex-preview-live-display-type 'buffer)
(unless (overlay-get ov 'after-string) (unless (overlay-get ov 'after-string)
;; NOTE: The latex-env-specific string includes a zero ;; NOTE: The latex-env-specific string includes a zero
@ -1051,10 +1065,10 @@ BOX-FACE is the face to apply in addition."
(defun org-latex-preview-live--src-buffer-setup () (defun org-latex-preview-live--src-buffer-setup ()
"Set up the org-src buffer for live LaTeX previews. "Set up the org-src buffer for live LaTeX previews.
If `org-latex-preview-auto-generate' is set to `live' and When `org-latex-preview-auto-mode' is turned on, and
`org-latex-preview-auto-mode' is turned on, live LaTeX previews `org-latex-preview-live' is either t or containes
are generated when editing a LaTeX fragment or environment using \"edit-special\", live LaTeX previews are generated when editing
`org-edit-special'. a LaTeX fragment or environment using `org-edit-special'.
If the source Org buffer is visible, these previews are displayed If the source Org buffer is visible, these previews are displayed
over the original fragment. Otherwise previews are displayed in over the original fragment. Otherwise previews are displayed in
@ -1064,10 +1078,9 @@ This is meant to be called via `org-src-mode-hook'."
(when (and (equal major-mode (org-src-get-lang-mode "latex")) (when (and (equal major-mode (org-src-get-lang-mode "latex"))
(buffer-local-value 'org-latex-preview-auto-mode (buffer-local-value 'org-latex-preview-auto-mode
(marker-buffer org-src--beg-marker)) (marker-buffer org-src--beg-marker))
(equal (let ((live (buffer-local-value 'org-latex-preview-live
(buffer-local-value 'org-latex-preview-auto-generate (marker-buffer org-src--beg-marker))))
(marker-buffer org-src--beg-marker)) (or (eq live t) (memq 'edit-special live))))
'live))
(let* ((org-buf (marker-buffer org-src--beg-marker)) (let* ((org-buf (marker-buffer org-src--beg-marker))
(src-buf (current-buffer)) (src-buf (current-buffer))
(org-buf-visible-p (window-live-p (get-buffer-window org-buf))) (org-buf-visible-p (window-live-p (get-buffer-window org-buf)))
@ -1110,7 +1123,7 @@ This is meant to be called via `org-src-mode-hook'."
(when-let ((numbering-table (org-latex-preview--environment-numbering-table))) (when-let ((numbering-table (org-latex-preview--environment-numbering-table)))
(setq numbering-offsets (list (gethash element numbering-table)))))) (setq numbering-offsets (list (gethash element numbering-table))))))
(when (eq (buffer-local-value 'org-latex-preview-auto-generate org-buf) 'live) (when (buffer-local-value 'org-latex-preview-live org-buf)
(if org-buf-visible-p (if org-buf-visible-p
;; Source Org buffer is visible: display live previews ;; Source Org buffer is visible: display live previews
;; over the fragment there ;; over the fragment there
@ -1123,15 +1136,15 @@ This is meant to be called via `org-src-mode-hook'."
(point-min) (point-max))))) (point-min) (point-max)))))
(with-current-buffer org-buf (with-current-buffer org-buf
(org-latex-preview-place (org-latex-preview-place
org-latex-preview-default-process org-latex-preview-process-default
(list (list (overlay-start orig-ov) (list (list (overlay-start orig-ov)
(overlay-end orig-ov) (overlay-end orig-ov)
content)) content))
numbering-offsets)))) numbering-offsets))))
(org-latex-preview-live--throttle (org-latex-preview-live--throttle
org-latex-preview-throttle) org-latex-preview-live-throttle)
(org-latex-preview-live--debounce (org-latex-preview-live--debounce
org-latex-preview-debounce))) org-latex-preview-live-debounce)))
(add-hook 'after-change-functions org-latex-preview-live--generator 90 'local)) (add-hook 'after-change-functions org-latex-preview-live--generator 90 'local))
;; Source Org buffer not visible: display live previews in org-src buffer ;; Source Org buffer not visible: display live previews in org-src buffer
@ -1146,14 +1159,14 @@ This is meant to be called via `org-src-mode-hook'."
;; Show live preview if available ;; Show live preview if available
(org-latex-preview-live--ensure-overlay ov) (org-latex-preview-live--ensure-overlay ov)
;; Set up hooks for live preview updates in the org-src buffer ;; Set up hooks for live preview updates in the org-src buffer
(add-hook 'org-latex-preview-update-overlay-functions (add-hook 'org-latex-preview-overlay-update-functions
#'org-latex-preview-live--update-overlay #'org-latex-preview-live--update-overlay
nil 'local) nil 'local)
(setq-local org-latex-preview-live--generator (setq-local org-latex-preview-live--generator
(thread-first (thread-first
(lambda (&rest _) (lambda (&rest _)
(org-latex-preview-place (org-latex-preview-place
org-latex-preview-default-process org-latex-preview-process-default
(list (list (save-excursion (goto-char (point-min)) (list (list (save-excursion (goto-char (point-min))
(skip-chars-forward "\n \t\r") (skip-chars-forward "\n \t\r")
(point)) (point))
@ -1162,11 +1175,11 @@ This is meant to be called via `org-src-mode-hook'."
(point)))) (point))))
numbering-offsets preamble)) numbering-offsets preamble))
(org-latex-preview-live--throttle (org-latex-preview-live--throttle
org-latex-preview-throttle) org-latex-preview-live-throttle)
(org-latex-preview-live--debounce (org-latex-preview-live--debounce
org-latex-preview-debounce))) org-latex-preview-live-debounce)))
(add-hook 'org-latex-preview-open-functions #'org-latex-preview-live--ensure-overlay nil 'local) (add-hook 'org-latex-preview-overlay-open-functions #'org-latex-preview-live--ensure-overlay nil 'local)
(add-hook 'org-latex-preview-close-functions #'org-latex-preview-live--clearout nil 'local) (add-hook 'org-latex-preview-overlay-close-functions #'org-latex-preview-live--clearout nil 'local)
(add-hook 'after-change-functions org-latex-preview-live--generator 90 'local))) (add-hook 'after-change-functions org-latex-preview-live--generator 90 'local)))
;; Turn on auto-mode behavior in the org-src buffer ;; Turn on auto-mode behavior in the org-src buffer
(add-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor nil 'local) (add-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor nil 'local)
@ -1190,38 +1203,38 @@ CALLBACK is supplied by Eldoc, see
(defun org-latex-preview-live--setup () (defun org-latex-preview-live--setup ()
"Set up hooks for live LaTeX previews. "Set up hooks for live LaTeX previews.
See `org-latex-preview-auto-generate' for details." See `org-latex-preview-live' for details."
(setq org-latex-preview-live--docstring " ") (setq org-latex-preview-live--docstring " ")
(setq-local org-latex-preview-live--generator (setq-local org-latex-preview-live--generator
(thread-first #'org-latex-preview-live--regenerate (thread-first #'org-latex-preview-live--regenerate
(org-latex-preview-live--throttle (org-latex-preview-live--throttle
org-latex-preview-throttle) org-latex-preview-live-throttle)
(org-latex-preview-live--debounce (org-latex-preview-live--debounce
org-latex-preview-debounce))) org-latex-preview-live-debounce)))
(when (eq org-latex-preview-live-display-type 'eldoc) (when (eq org-latex-preview-live-display-type 'eldoc)
(add-hook 'eldoc-documentation-functions #'org-latex-preview-live--display-in-eldoc nil t) (add-hook 'eldoc-documentation-functions #'org-latex-preview-live--display-in-eldoc nil t)
(add-hook 'org-latex-preview-update-overlay-functions #'org-latex-preview-live--update-eldoc nil 'local)) (add-hook 'org-latex-preview-overlay-update-functions #'org-latex-preview-live--update-eldoc nil 'local))
(add-hook 'org-src-mode-hook #'org-latex-preview-live--src-buffer-setup) (add-hook 'org-src-mode-hook #'org-latex-preview-live--src-buffer-setup)
(add-hook 'org-latex-preview-close-functions #'org-latex-preview-live--clearout nil 'local) (add-hook 'org-latex-preview-overlay-close-functions #'org-latex-preview-live--clearout nil 'local)
(add-hook 'org-latex-preview-open-functions #'org-latex-preview-live--ensure-overlay nil 'local) (add-hook 'org-latex-preview-overlay-open-functions #'org-latex-preview-live--ensure-overlay nil 'local)
(add-hook 'after-change-functions org-latex-preview-live--generator 90 'local) (add-hook 'after-change-functions org-latex-preview-live--generator 90 'local)
(add-hook 'org-latex-preview-update-overlay-functions #'org-latex-preview-live--update-overlay nil 'local)) (add-hook 'org-latex-preview-overlay-update-functions #'org-latex-preview-live--update-overlay nil 'local))
(defun org-latex-preview-live--teardown () (defun org-latex-preview-live--teardown ()
"Remove hooks for live LaTeX previews. "Remove hooks for live LaTeX previews.
See `org-latex-preview-auto-generate' for details." See `org-latex-preview-live' for details."
(when-let* ((props (get-char-property-and-overlay (point) 'org-overlay-type)) (when-let* ((props (get-char-property-and-overlay (point) 'org-overlay-type))
((eq (car props) 'org-latex-overlay)) ((eq (car props) 'org-latex-overlay))
(ov (cdr props))) (ov (cdr props)))
(org-latex-preview-live--clearout ov)) (org-latex-preview-live--clearout ov))
(when (eq org-latex-preview-live-display-type 'eldoc) (when (eq org-latex-preview-live-display-type 'eldoc)
(remove-hook 'eldoc-documentation-functions #'org-latex-preview-live--display-in-eldoc t) (remove-hook 'eldoc-documentation-functions #'org-latex-preview-live--display-in-eldoc t)
(remove-hook 'org-latex-preview-update-overlay-functions #'org-latex-preview-live--update-eldoc 'local)) (remove-hook 'org-latex-preview-overlay-update-functions #'org-latex-preview-live--update-eldoc 'local))
(remove-hook 'org-latex-preview-close-functions #'org-latex-preview-live--clearout 'local) (remove-hook 'org-latex-preview-overlay-close-functions #'org-latex-preview-live--clearout 'local)
(remove-hook 'org-latex-preview-open-functions #'org-latex-preview-live--ensure-overlay 'local) (remove-hook 'org-latex-preview-overlay-open-functions #'org-latex-preview-live--ensure-overlay 'local)
(remove-hook 'after-change-functions org-latex-preview-live--generator 'local) (remove-hook 'after-change-functions org-latex-preview-live--generator 'local)
(remove-hook 'org-latex-preview-update-overlay-functions #'org-latex-preview-live--update-overlay 'local) (remove-hook 'org-latex-preview-overlay-update-functions #'org-latex-preview-live--update-overlay 'local)
(setq-local org-latex-preview-live--generator nil)) (setq-local org-latex-preview-live--generator nil))
(defun org-latex-preview-clear-overlays (&optional beg end) (defun org-latex-preview-clear-overlays (&optional beg end)
@ -1240,7 +1253,7 @@ overlays were removed, nil otherwise."
"Preview LaTeX fragments between BEG and END. "Preview LaTeX fragments between BEG and END.
BEG and END are buffer positions." BEG and END are buffer positions."
(org-latex-preview-fragments (org-latex-preview-fragments
org-latex-preview-default-process org-latex-preview-process-default
beg end)) beg end))
;;;###autoload ;;;###autoload
@ -1340,11 +1353,11 @@ should it be enabled."
(if (org-latex-preview-clear-overlays beg end) (if (org-latex-preview-clear-overlays beg end)
(message "LaTeX preview removed") (message "LaTeX preview removed")
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process (list datum)))) org-latex-preview-process-default (list datum))))
;; When using auto-mode, but no current preview. ;; When using auto-mode, but no current preview.
((not ov) ((not ov)
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process (list datum)) org-latex-preview-process-default (list datum))
(message "Creating LaTeX preview")) (message "Creating LaTeX preview"))
;; When on a just written/edited fragment that should be previewed. ;; When on a just written/edited fragment that should be previewed.
((eq (overlay-get ov 'preview-state) 'modified) ((eq (overlay-get ov 'preview-state) 'modified)
@ -1545,7 +1558,7 @@ Faces in `org-latex-preview--ignored-faces' are ignored."
"Return a SHA1 hash for referencing LaTeX fragments when previewing them. "Return a SHA1 hash for referencing LaTeX fragments when previewing them.
PROCESSING-TYPE is the type of process used to create the PROCESSING-TYPE is the type of process used to create the
preview, see `org-latex-preview-default-process'. preview, see `org-latex-preview-process-default'.
PREAMBLE is the LaTeX preamble used in the generated LaTeX document. PREAMBLE is the LaTeX preamble used in the generated LaTeX document.
@ -1761,7 +1774,7 @@ When provided, LATEX-PREAMBLE overrides the default LaTeX preamble.
Returns a list of async tasks started." Returns a list of async tasks started."
(let* ((processing-type (let* ((processing-type
(or processing-type org-latex-preview-default-process)) (or processing-type org-latex-preview-process-default))
(latex-processor (latex-processor
(or latex-processor (or latex-processor
(and (derived-mode-p 'org-mode) (and (derived-mode-p 'org-mode)
@ -1783,7 +1796,7 @@ Returns a list of async tasks started."
(plist-put (copy-sequence processing-info) :image-input-type "xdv"))) (plist-put (copy-sequence processing-info) :image-input-type "xdv")))
(dolist (program programs) (dolist (program programs)
(org-check-external-command program error-message)) (org-check-external-command program error-message))
(when org-latex-preview-processing-indicator (when org-latex-preview-process-active-indicator
(dolist (fragment fragments-info) (dolist (fragment fragments-info)
(org-latex-preview--indicate-processing (org-latex-preview--indicate-processing
(plist-get fragment :overlay) 'on))) (plist-get fragment :overlay) 'on)))
@ -2009,7 +2022,7 @@ preview.sty for more details.")
"Create a LaTeX file based on PROCESSING-INFO and FRAGMENTS. "Create a LaTeX file based on PROCESSING-INFO and FRAGMENTS.
More specifically, a preamble will be generated based on More specifically, a preamble will be generated based on
PROCESSING-INFO. Then, if `org-latex-preview-precompile' is PROCESSING-INFO. Then, if `org-latex-preview-process-precompiled' is
non-nil, a precompiled format file will be generated if needed non-nil, a precompiled format file will be generated if needed
and used. Otherwise the preamble is used normally. and used. Otherwise the preamble is used normally.
@ -2044,7 +2057,7 @@ The path of the created LaTeX file is returned."
(precompile-failed-msg)) (precompile-failed-msg))
(when (and relative-file-p remote-file-p) (when (and relative-file-p remote-file-p)
(error "Org LaTeX Preview does not currently support \\input/\\include in remote files")) (error "Org LaTeX Preview does not currently support \\input/\\include in remote files"))
(when org-latex-preview-precompile (when org-latex-preview-process-precompiled
(pcase (plist-get processing-info :latex-processor) (pcase (plist-get processing-info :latex-processor)
("pdflatex" ("pdflatex"
(if-let ((format-file (org-latex-preview--precompile processing-info header (if-let ((format-file (org-latex-preview--precompile processing-info header
@ -2062,8 +2075,8 @@ The path of the created LaTeX file is returned."
'(org latex-preview disable-local-precompile) '(org latex-preview disable-local-precompile)
(concat (concat
precompile-failed-msg precompile-failed-msg
" Disabling LaTeX preview precompile in this buffer.\n To re-enable, run `(setq-local org-latex-preview-precompile t)' or reopen this buffer.")) " Disabling LaTeX preview precompile in this buffer.\n To re-enable, run `(setq-local org-latex-preview-process-precompiled t)' or reopen this buffer."))
(setq-local org-latex-preview-precompile nil))) (setq-local org-latex-preview-process-precompiled nil)))
(with-temp-file tex-temp-name (with-temp-file tex-temp-name
(insert header) (insert header)
;; The \abovedisplayskip length must be set after \begin{document} because ;; The \abovedisplayskip length must be set after \begin{document} because
@ -2332,7 +2345,7 @@ fragments in EXTENDED-INFO."
;; as it is currently known to cause issues. ;; as it is currently known to cause issues.
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(when (if (and org-latex-preview-precompile (when (if (and org-latex-preview-process-precompiled
(re-search-forward "^PRELOADED FILES:" nil t)) (re-search-forward "^PRELOADED FILES:" nil t))
(re-search-forward "^ *hyperref\\.sty" nil t) (re-search-forward "^ *hyperref\\.sty" nil t)
(re-search-forward "^(.*hyperref/hyperref\\.sty" nil t)) (re-search-forward "^(.*hyperref/hyperref\\.sty" nil t))
@ -2727,7 +2740,7 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run."
(org-persist-gc) (org-persist-gc)
(message "Cleared all %d entries fom the Org LaTeX preview cache." n))) (message "Cleared all %d entries fom the Org LaTeX preview cache." n)))
(let ((imagetype (let ((imagetype
(or (plist-get (alist-get org-latex-preview-default-process (or (plist-get (alist-get org-latex-preview-process-default
org-latex-preview-process-alist) org-latex-preview-process-alist)
:image-output-type) :image-output-type)
"png")) "png"))
@ -2750,7 +2763,7 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run."
(gethash element numbering-table)))) (gethash element numbering-table))))
(org-latex-preview--remove-cached (org-latex-preview--remove-cached
(org-latex-preview--hash (org-latex-preview--hash
org-latex-preview-default-process org-latex-preview-process-default
org-latex-preview--preamble-content org-latex-preview--preamble-content
value imagetype fg bg number)))) value imagetype fg bg number))))
(message "Cleared LaTeX preview cache for %s." (message "Cleared LaTeX preview cache for %s."

View File

@ -232,9 +232,9 @@
;;; No precompilation, no caching ;;; No precompilation, no caching
(ert-deftest test-org-latex-preview/place-previews-1 () (ert-deftest test-org-latex-preview/place-previews-1 ()
(org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc" (org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc"
(let ((org-latex-preview-precompile nil) (let ((org-latex-preview-process-precompiled nil)
(org-latex-preview-persist nil) (org-latex-preview-persist nil)
(org-latex-preview-default-process 'dvisvgm)) (org-latex-preview-process-default 'dvisvgm))
(org-latex-preview-auto-mode -1) (org-latex-preview-auto-mode -1)
(goto-char 255) (goto-char 255)
(let ((element (org-element-context))) (let ((element (org-element-context)))
@ -243,7 +243,7 @@
(org-element-property :end element)) (org-element-property :end element))
(apply #'org-async-wait-for (apply #'org-async-wait-for
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process org-latex-preview-process-default
(list element))) (list element)))
(let ((ov (cl-some (lambda (o) (and (eq (overlay-get o 'org-overlay-type) (let ((ov (cl-some (lambda (o) (and (eq (overlay-get o 'org-overlay-type)
'org-latex-overlay) 'org-latex-overlay)
@ -267,15 +267,15 @@
(ert-deftest test-org-latex-preview/place-previews-all () (ert-deftest test-org-latex-preview/place-previews-all ()
(org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc" (org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc"
(let ((org-latex-preview-precompile nil) (let ((org-latex-preview-process-precompiled nil)
(org-latex-preview-persist nil) (org-latex-preview-persist nil)
(org-latex-preview-default-process 'dvisvgm)) (org-latex-preview-process-default 'dvisvgm))
(org-latex-preview-auto-mode -1) (org-latex-preview-auto-mode -1)
(org-latex-preview-clear-cache (point-min) (point-max)) (org-latex-preview-clear-cache (point-min) (point-max))
(let ((elements (org-latex-preview-collect-fragments))) (let ((elements (org-latex-preview-collect-fragments)))
(apply #'org-async-wait-for (apply #'org-async-wait-for
(org-latex-preview--place-from-elements (org-latex-preview--place-from-elements
org-latex-preview-default-process org-latex-preview-process-default
elements)) elements))
(dolist (element elements) (dolist (element elements)
(let ((ov (cl-some (lambda (o) (and (eq (overlay-get o 'org-overlay-type) (let ((ov (cl-some (lambda (o) (and (eq (overlay-get o 'org-overlay-type)