org-latex-preview: Rename precompilation vars

* lisp/org-latex-preview.el (org-latex-preview-precompile,
org-latex-preview--latex-preview-filter,
org-latex-preview--create-tex-file,
org-latex-preview-use-precompilation, org-latex-preview--precompile):
Rename (i) the user option that controls precompilation for LaTeX
previews, and (ii) the function that precompiles headres for LaTeX
previews.  This makes the names shorter and consistent with their
corresponding equivalents in `ox-latex'.

Rename
`org-latex-preview-use-precompilation' -> `org-latex-preview-precompile'
`org-latex-preview-precompile' -> `org-latex-preview--precompile'

The new names have equivalents `org-latex-precompile' and
`org-latex--precompile' in `ox-latex'.

* testing/lisp/test-org-latex-preview.el: Update tests that set this
user option.

* etc/ORG-NEWS: Update the NEWS file.
This commit is contained in:
Karthik Chikmagalur 2023-06-03 15:06:58 -07:00 committed by TEC
parent 99f8c7b7fd
commit a9fbf9d7cf
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
3 changed files with 9 additions and 9 deletions

View File

@ -631,7 +631,7 @@ This option controls the width of text in preview images. This is
relevant for displaymath-type LaTeX environments, and can be specified
in multiple ways.
***** New option ~org-latex-preview-use-precompilation~ to control LaTeX precompilation
***** New option ~org-latex-preview-precompile~ to control LaTeX precompilation
This option controls whether LaTeX headers for buffers are precompiled
when generating the first preview for the buffer. Precompilation can

View File

@ -343,7 +343,7 @@ This can take a few forms, namely:
(float :tag "Proportional width")
(const :tag "Unset" nil)))
(defcustom org-latex-preview-use-precompilation t
(defcustom org-latex-preview-precompile t
"Use LaTeX header precompilation when previewing fragments.
This causes a slight delay the first time `org-latex-pdf-process'
is called in a buffer, but subsequent calls will be faster.
@ -1482,7 +1482,7 @@ previews."
"Create a LaTeX file based on PROCESSING-INFO and FRAGMENTS.
More specifically, a preamble will be generated based on
PROCESSING-INFO. Then, if `org-latex-preview-use-precompilation' is
PROCESSING-INFO. Then, if `org-latex-preview-precompile' is
non-nil, a precompiled format file will be generated if needed
and used. Otherwise the preamble is used normally.
@ -1513,8 +1513,8 @@ The path of the created LaTeX file is returned."
(coding-system-for-write buffer-file-coding-system))
(when (and relative-file-p remote-file-p)
(error "Org LaTeX Preview does not currently support \\input/\\include in remote files"))
(when org-latex-preview-use-precompilation
(if-let ((format-file (org-latex-preview-precompile processing-info header)))
(when org-latex-preview-precompile
(if-let ((format-file (org-latex-preview--precompile processing-info header)))
;; Replace header with .fmt file path.
(setq header (concat "%& " (file-name-sans-extension format-file)))
(display-warning
@ -1781,7 +1781,7 @@ fragments in EXTENDED-INFO."
;; as it is currently known to cause issues.
(save-excursion
(goto-char (point-min))
(when (if (and org-latex-preview-use-precompilation
(when (if (and org-latex-preview-precompile
(re-search-forward "^PRELOADED FILES:" nil t))
(re-search-forward "^ *hyperref\\.sty" nil t)
(re-search-forward "^(.*hyperref/hyperref\\.sty" nil t))
@ -2181,7 +2181,7 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run."
(when (or clear-entire-cache (not (or beg end)))
(org-latex-preview--clear-preamble-cache)))
(defun org-latex-preview-precompile (processing-info preamble &optional tempfile-p)
(defun org-latex-preview--precompile (processing-info preamble &optional tempfile-p)
"Precompile/dump LaTeX PREAMBLE text.
The path to the format file (.fmt) is returned. If the format

View File

@ -232,7 +232,7 @@
;;; No precompilation, no caching
(ert-deftest test-org-latex-preview/place-previews-1 ()
(org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc"
(let ((org-latex-preview-use-precompilation nil)
(let ((org-latex-preview-precompile nil)
(org-latex-preview-persist nil)
(org-latex-preview-default-process 'dvisvgm))
(org-latex-preview-auto-mode -1)
@ -267,7 +267,7 @@
(ert-deftest test-org-latex-preview/place-previews-all ()
(org-test-at-id "0b3807b3-69af-40cb-a27a-b380d54879cc"
(let ((org-latex-preview-use-precompilation nil)
(let ((org-latex-preview-precompile nil)
(org-latex-preview-persist nil)
(org-latex-preview-default-process 'dvisvgm))
(org-latex-preview-auto-mode -1)