Karthik Chikmagalur <[email protected]> writes:
>>> (defconst org-latex-preview--temp-cache-dir
>>> (expand-file-name "org-latex-preview" temporary-file-directory)
>>> "Folder used to cache temp-stored previews.")
>>
>> Please use (temporary-file-directory) call, not variable.
>
> Task recorded for final round, just before merging. This is to make it
> easy to rebase in the meantime.
Ok. Pending.
>>> (defconst org-latex-preview-live--cache-dir
>>> (expand-file-name "org-latex-preview-mode-display-live"
>>> temporary-file-directory)
>>> "Folder used to cache live previews.")
>>
>> Is it ever used? From the code, this would correspond to
>> org-latex-preview-cache = 'live (undocumented).
>
> Yes, it is used _heavily_. I can explain how:
> ...
Ok. I also figured it later in the review process, when I got to the
relevant code.
There is still a concern though - 'live looks like a valid user
option. Maybe you should use something else, more obviously internal?
> 4. So we cache intermediate states of live previews in
> org-latex-preview-live--cache-dir, with a counter that resets when
> org-latex-preview-live--max-cache-count (default 1024) live preview
> images have been generated. The live cache is wiped when the
> max-cache-count is reached. My org-persist disk usage and
> org-persist-gc time went down by a large factor after this, and cached
> images for the "finished" fragments were still available in org-persist.
Hmm. What if a single document contains more than 1024 fragments?
Will preview still work?
>>> "The document header used for processing LaTeX fragments.
>>> It is imperative that this header make sure that no page number
>>> appears on the page. The package defined in the variables
>>> `org-latex-default-packages-alist' and `org-latex-packages-alist'
>>> will either replace the placeholder \"[PACKAGES]\" in this
>>> header, or they will be appended."
>>
>> This is not "or they will be appended", but more subtle. See the
>> docstring of org-latex-classes.
>
> The docstring is an exact copy of that of org-format-latex-header on
> main. I don't understand the "appended" part here or the docstring of
> org-latex-classes, so please suggest a replacement.
Oops. That's not the right docstring. What I meant is
org-splice-latex-header that says
For backward compatibility, if both the positive and the negative place
holder is missing, the positive one (without the \"NO-\") will be
assumed to be present at the end of the template.
That's where "appended" is coming from.
>>> (defcustom org-latex-preview-mode-track-inserts t
>>
>> I am looking that this is enabled by default, and that it is mentioned
>> in the manual. But I am wondering why would everyone want to disable
>> this option while keeping org-latex-preview-mode. Maybe it is not worth
>> mentioning this option in the manual?
>
> You may want the ability to hide/show preview images automatically by
> moving into/out of fragments, but not call LaTeX automatically as you
> type or paste text. In this case you can set track-inserts to nil.
>
> This is a common enough need -- starting LaTeX from post-command-hook
> can cause performance issues when typing or pasting in a large quantity
> of text. Setting track-inserts to nil means that you can delay the
> tracking until you call org-latex-preview once.
>
> The nil value behavior of track-inserts is also the default behavior of
> preview-latex from AucTeX. So I think it is worth mentioning in the
> manual.
Ok.
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>