The `default-buffer` is apparently not optional when the current buffer is not
associated with a file. If `default-buffer` is missing and the current buffer
is not a file-buffer, e.g., a note buffer, then `org-refile-get-targets` fails.
When finding the location of an Org mode item to link to,
`org-refile-get-location` may return a point even if the target buffer is not
the default buffer. Resolving point in the default buffer thus yields a false
marker and the inserted link is wrong. To remedy this, also consider the file
name returned by `org-refile-get-location` to resolve point in the file buffer
for that file.
`org-refile-get-location` sometimes only returns a point and not a marker. In
that case, manually convert the point to a marker to ensure that calling
functions now where to go to. Additionally, ensure that
`db/org-default-org-file` is opened if not already done so, and error out if the
current buffer is not associated with a file and no default Org file exists.
We are only using the refile mechanism for convenience here, and not for actual
refiling. The refile verification function is thus not relevant here. To take
effect, we also have to ignore the cache, as it may hold precomputed targets
that have used the refile verification function in a previous run.
Sometimes an instance of a periodic tasks requires individual subtasks. In this
case, refiling there is very helpful. In other cases, the extra entries should
not be disturbing too much, I think … I hope.
Include all headlines in Org agenda files and as well as all extra text search
files in interactive selections. To make this more managable, introduce a
dedicated function to query the user for a target item.
The main entry point is now `db/org-find-links-to-current-item', which decides
how to obtain the ID and CUSTOM_ID of the item to look for. The main work is
done by `db/org-find-items-linking-to-id', which does some checks, build the
query, and then calls `org-search-view' (which, indeed, does the actual work).
Users should call `db/org-find-links-to-current-item' only.
Neither logging information not tasks should be part of that file, so keeping it
in `org-agenda-files' is not really necessary. Indeed, it has only been
included in there to allow `org-search-view' to search that file. However, with
using `org-agenda-text-search-extra-files' makes this approach obsolete.
Previously, we only copied the last element in the subtree, assuming that this
encompasses all of the content of the subtree. However, this is not true, and
thus we have to do something more elaborate. Now, starting from the end of the
subtree, we go up all elements in the subtree until we reach either the headline
or a drawer. Everything in between is copied as template to the current
location.
The shortcut in the frequently-used menu now points there, and not anymore to
the dedicated home and work files. If only a single main Org Mode file is used,
this variable should be sufficient.
If separate things should be done, generate a separate item for it, or leave
some note at the corresponding series element. Periodic tasks are quite rigid
and should not be used for collecting individual subtasks.