This dynamic block will list all items (including their priority) that link to
the item at point or to any of its parent items. The use case for this is to
have a series of periodic appointments where certain topics should be
discussed (“jour fixe”), and where those topics can be referenced in those
appointments via backlinks. However, simple backlinks to an item on a fixed
date is not sufficient here, as there might not be enough time on that day to
discuss all items. To avoid having to manipulate all backlinks that could not
be discussed, one could simply add a reference to the parent item of all
appointments of the jour fixe series. Using the new dynamic block introduced
here, this item will be on the list of open topics until it's closed.
Somehow, using lispy in the minibuffer causes random indentations although
everythin is on the same line. This might not be an issue with lispy itself,
disabling it however makes the symptom go away. Since I am not using lispy
features in the minibuffer anyway, I can as well switch it off.
There's a new mode map `eshell-hist-mode-map` which already contains a binding
for `M-r`, so we have to redefine that key binding there to make it work.
It does not make sense to look in non-Org buffers for backlinks of items, but
this was indeed what happend until now: the function `db/org-get-location` only
checked whether the current buffer is associated with a file, and if so uses it
for querying the user for an item to select. This does not make sense, as
`db/org-get-location` is supposed to return a mark to an Org item.
This is now fixed by `db/org-get-location` to also check whether the current
buffer is also an Org buffer. It's as simple as that.
This function is not meant for interactive use, but instead should be used in
source blocks such as
```
(db/org-backlinks-to-item-at-point)
```
This will add a table of all items linking to the current item at point, and cut
be used in item templates, for example.
Background: I tried to achive this functionality with `org-ql` directly, but
somehow failed. This function simply encapsulates the corresponding call to
`org-ql-query`, adding the ID property of item at point automatically.
This allows to keep ideas for later in dedicated NOTE items, to group them
together. Not sure whether this is really a good idea, as it spreads those
ideas around, but let's try it out!
When inserting links multiple times, it's annoying to have to go back to the
original place the link points to and reinsert it into the stored link list.
Using a universal argument to toggle `org-link-keep-stored-after-insertion` is
also not an option, as I keep forgetting to use it.
Instead, by default keep all links after insertion. To be able to handle the
growing list of links, we now provide a function `db/org-clear-stored-links` to
set the list of stored links to the empty list.
We want `org-ql-search`, but need to install `org-ql`, so it's best to simply state
this in the `:ensure` declaration.
The `:commands` specification might be redundant, as `org-ql` comes with an
autoload file. But let's keep it there for clarify purposes.
This includes, among others, a dynamic block to insert the result of a query –
which is exactly what I am looking for. I have to learn a new query language,
though, but it seems as if non-sexp syntax is easy enough; and having a
lisp-like query syntax is undoubtedly a big improvement!