To determine whether a merge is in progress, do not check in the current
directory for .git/MERGE_HEAD, but do this in the repository directory.
When computing `base-dir`, take the whole non-directory part, not just the
basename; otherwise directories like .emacs.d will get the final `.d` get
stripped off.
This allows to see of which git repository the current working directory is part
of.
This is also included in Howard Abrams configuration, but he instead determines
the name of the current git repository by looking at `remote.origin.url`.
However, my upstream branch is not always called `origin`, and sometimes there
is no upstream repository at all. Using the name of the current directory (not
the whole path, though) instead seems to be a good compromise from my point of
view.
The project is archived and no longer available from melpa, so let's keep a
local copy with us.
It might be necessary to add an extra use-package declaration with autoload
definitions, but we'll do that when it's clear it's necessary.
This partially reverts cff8720a44, but keeps the
doc-string.
Rationale: TOPICs may contain notes which should be reviewd regularly. Those
TOPICs should also be tagged with NOTE but could (and should) in addition
contain sub-items about concrete tasks. In this case refiling to a NOTE should
be allowed.
Maybe limiting refiling to NOTE:TOPIC combinations would be more strict here,
but I think this complexity is not (yet) worth it.
Sometimes only the backlinks to the items itself might be interesting, or
backlinks to the current item and its direct parent. To allow for easy
insertion of dynamic backlink blocks in those cases as well, include a
:parent-depth parameter. The default value of nil means no limit is imposed, as
has been the case until now.
The idea is that those entries represent project notes which should not get
tasks refiled as sub-items (sub-headings to structure these notes are fine,
though, and must be added directly). To connect tasks with project notes, use
links and backlinks instead.
This helps to prevent accidental refiling of tasks under notes and loosing them
there. A drawback is that `C-u org-refile` won't list notes as visiting targets
anymore; for this, use imenu instead.
Mostly making use of pcase-*, but I am not quite sure whether the `(,foo . ,bar)
syntax really helps …
Also adjusted some comments and some formatting.
We are interested in the backlinks so we now put them first. The backlink
targets (i.e., current item or any of its parents) are now grouped after the
priority of the item containing the backlink.
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.
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.
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.
It happens sometimes that the clock is not active, in which case hydra tried to
replace strings in `org-clock-current-task`, then a nil value. Fixed this.