COMPLETING-READ, when used with its REQUIRE-MATCH argument, would not
allow a result to be selected when ORG-QL-FIND was called with its
QUERY-PREFIX argument.
This change moves where the query is modified to include the prefix,
putting it into the RUN-QUERY function instead of the COLLECTION
function. It seems to solve the problem, and the function seems to
still work when used without QUERY-PREFIX. However, due to the
complexity of all this (we really need a SELECTING-READ API), it
wouldn't surprise me if something is later found to have been broken
by it...
Fixes#351.
Reported-by: Daniel Fleischer <https://github.com/danielfleischer>
Also use org-entry-get to get the heading, which should avoid issues
with different Org versions having different optional arguments to
org-get-heading.
This seems to work better now with default Emacs completion (i.e. not
using Vertico or Helm). It's still not perfect, but it seems to work
reasonably well and be more correct.
Fixes#338. Thanks to @arozbiz for reporting.