231 lines
10 KiB
HTML
231 lines
10 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html>
|
|||
|
<head>
|
|||
|
<meta charset="utf-8">
|
|||
|
<title>2022-01-31-caching.org.html</title>
|
|||
|
<style>
|
|||
|
body { background: #fafafa; color: #2a2a2a; }
|
|||
|
pre {
|
|||
|
font-size: 1rem;
|
|||
|
max-width: min(100rem, 100%);
|
|||
|
width: max-content;
|
|||
|
white-space: pre-wrap;
|
|||
|
margin: auto; }
|
|||
|
.ef-D {
|
|||
|
color: #2a2a2a;
|
|||
|
background-color: #fafafa;
|
|||
|
font-weight: 400; }
|
|||
|
.ef-k {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-d {
|
|||
|
color: #b6b6b6; }
|
|||
|
.ef-t {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-s {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-w {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-b {
|
|||
|
color: #29838d; }
|
|||
|
.ef-ct {
|
|||
|
color: #b1b1b1; }
|
|||
|
.ef-c {
|
|||
|
color: #97365b; }
|
|||
|
.ef-pp {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-nc {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-v {
|
|||
|
color: #cb9aad; }
|
|||
|
.ef-f {
|
|||
|
color: #29838d; }
|
|||
|
.ef-cd {
|
|||
|
color: #b1b1b1; }
|
|||
|
.ef-rc {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-rb {
|
|||
|
color: #3b6ea8;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-ob {
|
|||
|
}
|
|||
|
.ef-hn {
|
|||
|
color: #97365b;
|
|||
|
font-weight: 700; }
|
|||
|
.ef-hq {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-hs {
|
|||
|
color: #9a7500; }
|
|||
|
.ef-rdi {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-rdii {
|
|||
|
color: #97365b; }
|
|||
|
.ef-rdiii {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-rdiv {
|
|||
|
color: #842879; }
|
|||
|
.ef-rdv {
|
|||
|
color: #29838d; }
|
|||
|
.ef-rdvi {
|
|||
|
color: #3b6ea8; }
|
|||
|
.ef-rdvii {
|
|||
|
color: #97365b; }
|
|||
|
.ef-rdiix {
|
|||
|
color: #4f894c; }
|
|||
|
.ef-rdix {
|
|||
|
color: #842879; }
|
|||
|
</style>
|
|||
|
</head>
|
|||
|
<body>
|
|||
|
<pre>
|
|||
|
<span style="color: #9e9e9e;">#+title:</span> <span style="color: #29838d; font-weight: 700;">January 2022
|
|||
|
</span><span style="color: #9e9e9e;">#+subtitle:</span> <span style="color: #29838d;">Caching
|
|||
|
</span><span style="color: #9e9e9e;">#+author:</span> <span style="color: #29838d;">TEC
|
|||
|
</span><span style="color: #9e9e9e;">#+date:</span> <span style="color: #29838d;">2022-01-31
|
|||
|
</span>
|
|||
|
There are less "obvious user-facing changes" this month, but a lot of good work
|
|||
|
has been happening 🙂.
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* The cache continues to make strides</span>
|
|||
|
|
|||
|
Nine months ago, Ihor started working on the org-element cache. The cache has
|
|||
|
existed for a while now, but it used to be too buggy to be useful.
|
|||
|
|
|||
|
This is no longer the case! We're finally confident enough to flip
|
|||
|
<span style="color: #ac4426;">~org-element-use-cache~</span>'s default from <span style="color: #ac4426;">~nil~</span> to <span style="color: #ac4426;">~t~</span>. I mentioned some of the
|
|||
|
improvements in <span style="color: #3b6ea8; font-weight: 700;">[[file:2021-11-30-element.org::Org element parser cache][November]]</span>, however Ihor has continued to make strides with the
|
|||
|
cache.
|
|||
|
|
|||
|
Getting the cache right is tough though, and so while the situation is much
|
|||
|
improved there are still lingering bugs which need to be chased down. If you
|
|||
|
only take one thing away from the post, I'd like it to be this:
|
|||
|
|
|||
|
<span style="color: #b1b1b1;">#+begin_info
|
|||
|
</span>#+html: <div style="text-align: left; margin-left: 1rem;">
|
|||
|
The cache is actively being developed now, for the first time in years, so:
|
|||
|
1. Ignore old advice (like <span style="color: #3b6ea8; font-weight: 700;">[[https://emacs.stackexchange.com/questions/42006/trouble-with-org-mode][this]]</span>) which suggests disabling the cache
|
|||
|
- Note that the cache will <span style="text-decoration: italic;">/not/</span> stuff anything up, at worst it will emit a warning
|
|||
|
2. If you see an org-cache warning <span style="text-decoration: italic;">/please/</span> report it to the Org mailing list ---
|
|||
|
<span style="color: #4f894c;">=emacs-orgmode@gnu.org=</span>.
|
|||
|
|
|||
|
Cache warnings look something like this:
|
|||
|
#+begin_example
|
|||
|
Warning (org-element-cache): org-element--cache: Unregistered buffer modifications detected. Resetting.
|
|||
|
If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).
|
|||
|
The buffer is: config.org
|
|||
|
Current command: (some-buggy-command)
|
|||
|
Chars modified: 483
|
|||
|
Buffer modified: 330957
|
|||
|
Backtrace:
|
|||
|
...some possibly long backtrace...
|
|||
|
#+end_example
|
|||
|
|
|||
|
A good way to start is by copying this to your clipboard and then trying <span style="color: #4f894c;">=M-x
|
|||
|
org-submit-bug-report=</span>. Regardless of whether you're using an Emacs mail client,
|
|||
|
this will collect all the important information (org-mode version, etc.) and
|
|||
|
populate a buffer with it. Add the warning text, and that will be a great help!
|
|||
|
After all, it's quite hard to fix bugs we don't know about 😆.
|
|||
|
#+html: </div>
|
|||
|
<span style="color: #b1b1b1;">#+end_info
|
|||
|
</span>
|
|||
|
As of October 2021, "bulk" heading promotion/demotion operations are now faster
|
|||
|
thanks to the cache, and there have now been further improvements relating to
|
|||
|
headings. It used to be the case that every time heading properties changed the
|
|||
|
entire heading (and contents) were re-parsed. Now, cache heuristics prevent the
|
|||
|
content from being entirely re-parsed (see
|
|||
|
<span style="color: #ac4426;">~org-element--cache-avoid-synchronous-headline-re-parsing~</span> for a bit more
|
|||
|
information). This improvement is particularly noticeable when refiling and
|
|||
|
archiving headings.
|
|||
|
|
|||
|
<span style="color: #b1b1b1;">#+begin_src julia :exports none
|
|||
|
</span><span style="color: #3b6ea8;">using</span><span class="ef-ob"> StatsBase, Dates
|
|||
|
|
|||
|
timestamps = read(setenv(</span><span style="color: #4f894c;">`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' --author="Ihor Radchenko <yantar92@gmail.com>" --grep=cache`</span><span class="ef-ob">,
|
|||
|
dir=</span><span style="color: #4f894c;">"/home/tec/.emacs.d/.local/straight/repos/org-mode/"</span><span class="ef-ob">), String) |>
|
|||
|
strip |> split .|> DateTime
|
|||
|
|
|||
|
timestamps = DateTime.(timestamps)
|
|||
|
Dates.month.(timestamps) |> countmap
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
<span style="color: #b6b6b6;">#+RESULTS:</span>
|
|||
|
<span style="color: #842879;">| 1 | 20 |</span>
|
|||
|
<span style="color: #842879;">| 12 | 23 |</span>
|
|||
|
<span style="color: #842879;">| 10 | 42 |</span>
|
|||
|
<span style="color: #842879;">| 11 | 22 |</span>
|
|||
|
<span style="color: #842879;">| 5 | 6 |</span>
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Persisting data</span>
|
|||
|
|
|||
|
<span style="color: #b1b1b1;">#+begin_src julia :exports none
|
|||
|
</span><span style="color: #3b6ea8;">using</span><span class="ef-ob"> StatsBase, Dates
|
|||
|
|
|||
|
timestamps = read(setenv(</span><span style="color: #4f894c;">`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' -- "lisp/org-persist.el"`</span><span class="ef-ob">,
|
|||
|
dir=</span><span style="color: #4f894c;">"/home/tec/.emacs.d/.local/straight/repos/org-mode/"</span><span class="ef-ob">), String) |>
|
|||
|
strip |> split .|> DateTime
|
|||
|
|
|||
|
timestamps = DateTime.(timestamps)
|
|||
|
Dates.month.(timestamps) |> countmap
|
|||
|
</span><span style="color: #b1b1b1;">#+end_src
|
|||
|
</span>
|
|||
|
<span style="color: #b6b6b6;">#+RESULTS:</span>
|
|||
|
<span style="color: #842879;">| 1 | 28 |</span>
|
|||
|
<span style="color: #842879;">| 12 | 4 |</span>
|
|||
|
<span style="color: #842879;">| 10 | 19 |</span>
|
|||
|
<span style="color: #842879;">| 11 | 4 |</span>
|
|||
|
|
|||
|
In October, Ihor started work on <span style="color: #4f894c;">=org-persist.el=</span> --- a way to <span style="text-decoration: italic;">/persist/</span> data across
|
|||
|
Emacs sessions. You may wonder what sort of data is being persisted. Well,
|
|||
|
initially org-persist was written to record variable values associated with
|
|||
|
particular files or buffers --- such as the org-element cache. This allows
|
|||
|
org-mode to load the cache for an Org file and avoid re-parsing much of the
|
|||
|
content.
|
|||
|
|
|||
|
Over the past month, Ihor has <span style="text-decoration: italic;">/doubled/</span> the total number of commits applied to
|
|||
|
<span style="color: #4f894c;">=org-persist.el=</span> and now more kinds of data can be persisted, such as remote files
|
|||
|
(via. tramp) and online resources. This opens up a lot of new possibilities, and
|
|||
|
we can begin to see what this will allow for in the next highlight.
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Exporting documents with remote resources</span>
|
|||
|
|
|||
|
Ever linked to an online image like
|
|||
|
<span style="color: #4f894c;">=</span><span style="color: #4f894c; font-weight: 700;">https://orgmode.org/resources/img/org-mode-unicorn.svg</span><span style="color: #4f894c;">=</span> in an Org document, seen
|
|||
|
it look nice in the HTML export and then be disappointed to just see a link in
|
|||
|
LaTeX? Well I have. Thankfully this is no longer the case though, thanks to a
|
|||
|
helper function <span style="color: #ac4426;">~org-export-link-localise~</span> that's just been added to <span style="color: #4f894c;">=ox.el=</span>.
|
|||
|
|
|||
|
Using <span style="color: #4f894c;">=org-persist.el=</span> this acquires a local copy of the remote resource and
|
|||
|
substitutes it in for the remote link. This is currently utilised in <span style="color: #4f894c;">=ox-latex.el=</span>
|
|||
|
to provide support for not just HTTPS links but also tramp files!
|
|||
|
|
|||
|
<span style="color: #b6b6b6;">#+caption:</span> <span class="ef-ob">A screenshot of a (compiled to PDF) LaTeX export, with an HTTPS and tramp images.</span>
|
|||
|
<span style="color: #b6b6b6;">#+attr_html: :class invertible</span>
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">[[file:figures/ox-latex-image-link-localisation-demo.png]]</span>
|
|||
|
|
|||
|
While this is currently only implemented for <span style="color: #4f894c;">=ox-latex=</span>, this can be applied
|
|||
|
generally, and so there's a good chance you'll hear more about this in the future.
|
|||
|
|
|||
|
There are also thoughts of moving this to the links file (<span style="color: #4f894c;">=ol.el=</span>) which would
|
|||
|
make this functionality more broadly accessible (e.g. using cached/local
|
|||
|
versions of a resource in other places, and defining custom downloaders for
|
|||
|
custom link types).
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Other improvements</span>
|
|||
|
+ Produce less native-comp warnings _Ihor Radchenko_
|
|||
|
+ Add a header to the clock report table _Samim Pezeshki_
|
|||
|
+ More verbose test failure summary _Max Nikulin_
|
|||
|
+ Parallelise <span style="color: #4f894c;">=make=</span>ing the docs _Marco Wahl_
|
|||
|
+ More org-element tests _Ihor Radchenko_
|
|||
|
|
|||
|
<span style="color: #3b6ea8; font-weight: 700;">* Bugfixes</span>
|
|||
|
+ Fix formatting in elisp-link prompt _TEC_
|
|||
|
+ Correct some checkdoc and compiler warnings _Ihor Radchenko_
|
|||
|
+ Correct signature for <span style="color: #ac4426;">~org-element-at-point~</span> _Mark A. Hershberger_
|
|||
|
+ Fix the LaTeX macron accent in org-entities _TEC_
|
|||
|
+ Ignore narrowing when tangling a file _Nicolas Goaziou_
|
|||
|
|
|||
|
</pre>
|
|||
|
<body>
|
|||
|
</html>
|