this-month-in-org/2022-01-31-caching.org.html

266 lines
11 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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-b {
font-weight: 700; }
.ef-i {
text-decoration: italic; }
.ef-vp {
}
.ef-h {
color: #9e9e9e; }
.ef-sc {
color: #4f894c; }
.ef-w {
color: #9a7500; }
.ef-e {
color: #99324b; }
.ef-l {
color: #3b6ea8; font-weight: 700; }
.ef-lv {
color: #8b008b; font-weight: 700; }
.ef-hi {
color: #fafafa; background-color: #3b6ea8; }
.ef-c {
color: #b1b1b1; }
.ef-cd {
color: #b1b1b1; }
.ef-s {
color: #4f894c; }
.ef-d {
color: #b6b6b6; }
.ef-m {
color: #97365b; }
.ef-k {
color: #3b6ea8; }
.ef-bi {
color: #29838d; }
.ef-f {
color: #29838d; }
.ef-v {
color: #cb9aad; }
.ef-t {
color: #9a7500; }
.ef-o {
color: #97365b; }
.ef-wr {
color: #9a7500; }
.ef-nc {
color: #3b6ea8; font-weight: 700; }
.ef-pp {
color: #3b6ea8; font-weight: 700; }
.ef-rc {
color: #3b6ea8; font-weight: 700; }
.ef-rb {
color: #3b6ea8; font-weight: 700; }
.ef-ob {
background-color: #e0e0e0; }
.ef-obb {
color: #b1b1b1; background-color: #e0e0e0; }
.ef-obe {
color: #b1b1b1; background-color: #e0e0e0; }
.ef-Oa {
color: #3b6ea8; font-weight: nil; font-size: 1.25em }
.ef-Ob {
color: #97365b; font-weight: 700; font-size: 1.15em }
.ef-Oc {
color: #842879; font-weight: 700; font-size: 1.12em }
.ef-Od {
color: #6c92bd; font-weight: 600; font-size: 1.09em }
.ef-Oe {
color: #b16883; font-weight: 600; font-size: 1.06em }
.ef-Of {
color: #9db6d3; font-weight: 600; font-size: 1.03em }
.ef-Og {
color: #cb9aad; font-weight: 700; }
.ef-Oh {
color: #d7e2ed; font-weight: 600; }
.ef-hn {
color: #97365b; font-weight: 700; }
.ef-hq {
color: #3b6ea8; }
.ef-hs {
color: #9a7500; }
.ef-rda {
color: #3b6ea8; }
.ef-rdb {
color: #97365b; }
.ef-rdc {
color: #4f894c; }
.ef-rdd {
color: #842879; }
.ef-rde {
color: #29838d; }
.ef-rdf {
color: #3b6ea8; }
.ef-rdg {
color: #97365b; }
.ef-rdh {
color: #4f894c; }
.ef-rdi {
color: #842879; }
</style>
</head>
<body>
<pre>
<span style="color: #9e9e9e;">#+title:</span> <span style="font-weight: 700;">January 2022
</span><span style="color: #9e9e9e;">#+subtitle:</span> Caching
<span style="color: #9e9e9e;">#+author:</span> TEC
<span style="color: #9e9e9e;">#+date:</span> 2022-01-31
There are less "obvious user-facing changes" this month, but a lot of good work
has been happening 🙂.
<span style="color: #3b6ea8; font-weight: nil; font-size: 1.25em">* 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: #9e9e9e;">~org-element-use-cache~</span>'s default from <span style="color: #9e9e9e;">~nil~</span> to <span style="color: #9e9e9e;">~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 class="ef-obb">#+begin_info
</span>#+html: &lt;div style="text-align: left; margin-left: 1rem;"&gt;
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 class="ef-i">/not/</span> stuff anything up, at worst it will emit a warning
2. If you see an org-cache warning <span class="ef-i">/please/</span> report it to the Org mailing list ---
<span style="color: #9e9e9e;">=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: #9e9e9e;">=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: &lt;/div&gt;
<span class="ef-obe">#+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: #9e9e9e;">~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 class="ef-obb">#+begin_src julia :exports none
</span><span class="ef-ob">using StatsBase, Dates
timestamps = read(setenv(`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' --author="Ihor Radchenko &lt;yantar92@gmail.com&gt;" --grep=cache`,
dir="/home/tec/.emacs.d/.local/straight/repos/org-mode/"), String) |&gt;
strip |&gt; split .|&gt; DateTime
timestamps = DateTime.(timestamps)
Dates.month.(timestamps) |&gt; countmap
</span><span class="ef-obe">#+end_src
</span>
<span style="color: #b1b1b1;">#+RESULTS:</span>
| 1 | 20 |
| 12 | 23 |
| 10 | 42 |
| 11 | 22 |
| 5 | 6 |
<span style="color: #3b6ea8; font-weight: nil; font-size: 1.25em">* Persisting data</span>
<span class="ef-obb">#+begin_src julia :exports none
</span><span class="ef-ob">using StatsBase, Dates
timestamps = read(setenv(`git log --format='%ad' --date=format:'%Y-%m-%dT%H:%M:%S' -- "lisp/org-persist.el"`,
dir="/home/tec/.emacs.d/.local/straight/repos/org-mode/"), String) |&gt;
strip |&gt; split .|&gt; DateTime
timestamps = DateTime.(timestamps)
Dates.month.(timestamps) |&gt; countmap
</span><span class="ef-obe">#+end_src
</span>
<span style="color: #b1b1b1;">#+RESULTS:</span>
| 1 | 28 |
| 12 | 4 |
| 10 | 19 |
| 11 | 4 |
In October, Ihor started work on <span style="color: #9e9e9e;">=org-persist.el=</span> --- a way to <span class="ef-i">/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 class="ef-i">/doubled/</span> the total number of commits applied to
<span style="color: #9e9e9e;">=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: nil; font-size: 1.25em">* Exporting documents with remote resources</span>
Ever linked to an online image like
<span style="color: #9e9e9e;">=</span><span style="color: #9e9e9e; font-weight: 700;">https://orgmode.org/resources/img/org-mode-unicorn.svg</span><span style="color: #9e9e9e;">=</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: #9e9e9e;">~org-export-link-localise~</span> that's just been added to <span style="color: #9e9e9e;">=ox.el=</span>.
Using <span style="color: #9e9e9e;">=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: #9e9e9e;">=ox-latex.el=</span>
to provide support for not just HTTPS links but also tramp files!
<span style="color: #b1b1b1;">#+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: #b1b1b1;">#+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: #9e9e9e;">=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: #9e9e9e;">=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: nil; font-size: 1.25em">* 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: #9e9e9e;">=make=</span>ing the docs _Marco Wahl_
+ More org-element tests _Ihor Radchenko_
<span style="color: #3b6ea8; font-weight: nil; font-size: 1.25em">* Bugfixes</span>
+ Fix formatting in elisp-link prompt _TEC_
+ Correct some checkdoc and compiler warnings _Ihor Radchenko_
+ Correct signature for <span style="color: #9e9e9e;">~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>