emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] [BUG] inconsistent behavior when reading multiple tags [9.4.6


From: No Wayman
Subject: Re: [BUG] [BUG] inconsistent behavior when reading multiple tags [9.4.6 (9.4.6-g366444 @ /home/n/.emacs.d/straight/build/org/)]
Date: Fri, 03 Sep 2021 13:13:45 -0400
User-agent: mu4e 1.6.4; emacs 28.0.50


Allen Li <darkfeline@felesatra.moe> writes:

Sorry about that (I wrote the crm patch). I did not consider people deliberately using invalid tag characters to separate tags. It's an (un?)happy coincidence that org-set-tags-commands retains this behavior,
because the fast tags selection logic gets in the way.

The inconsistency in behavior can be easily fixed by deleting the code in org-set-tags-commands that replaces invalid tag characters with ":".

The question here is, which behavior do we want? My philosphy is that programs shouldn't try to silently re-interpret the user's intentions.
For example, if I accidentally mistyped the tag "green_blue" as
"green-blue", I don't want Org to "helpfully" split one tag into two tags "green:blue". I may not realize the data corruption until too
late.

Consider the current behavior of `org-capture-fill-template':

If you were to mistype your tag as "green-blue" it would be captured as part of the headline string instead of a set of tags. Future tag completions would not include any reference to it, and so you likely wouldn't notice until long after the fact (especially in the case of a template with a non-nil :immediate-finish). So the risk of data corruption exists now by allowing the function to return an invalid tag string.

There's also the option to only allow ":" and "," as separators.
Whichever behavior we choose, I don't think it's worth making it customizable.

I would rather not have to type ":" to separate Org tags when CRM allows me to use "," (or another character of my choice) everywhere else. This violates the principle of least surprise.

An even simpler solution than my original patch is to have a defcustom which allows the user to customize
the CRM separator character(s) Org uses to read tags.

See the attached patch for a first draft implementation.

It defaults to what you've proposed (allowing ":" and "," to delimit tags). It avoids introducing a new regexp variable which needs to be maintained in lockstep with `org-tag-re'.
It's customizable.
It informs the user about the tag delimiting characters in the prompt.

Attachment: 0001-Add-org-tags-crm-separators.patch
Description: org-tags-crm-separators-defcustom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]