Morgan Smith <[email protected]> writes:

> So in the example we have
>
> TIMESTAMP_IA="<2025-
>
> Then we press TAB.  Then we have:
>
> TIMESTAMP_IA="<2025-test
>
> So I decided to add a bail out for unbalanced quotes as that seems like
> the sane option to me.

I am not sure if it is a good idea. What you are essentially doing is
trying to provide some kind of fix working around the fact that
`org-tags-completion-function' is called inappropriately by
`org-make-tags-matcher'. But I do not think that doing it in
`org-tags-completion-function' itself is the right approach:

    (defun org-tags-completion-function (string _predicate &optional flag)
      "Complete tag STRING.
    FLAG specifies the type of completion operation to perform.  This
    function is passed as a collection function to `completing-read',
    which see."

This function does exactly when it intends to, as per docstring. It is
not its fault that it is called incorrectly.

What we should rather do is create a new org-tags-matcher-completion-function
that will handle matcher syntax. Balances quoted, and all other
intricacies are to be handled there.

If we cannot fully implement it just yet, we can at least define it,
maybe add this balanced parenthesis workaround inside, and call
`org-tags-completion-function' as a temporary measure, supplied with
appropriate FIXME comment.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to