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: Allen Li
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: Thu, 02 Sep 2021 23:51:42 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

No Wayman <iarchivedmywholelife@gmail.com> writes:

> org-set-tags-command correctly parses the tags when using a comma
> (the default
> crm-separator) to separate them, but completion is broken unless
> ":" is used as
> the separator.
> org-capture-fill-template incorrectly parses this.
>
> Reproducible from emacs -Q:
>
> org-set-tags-command:
> 1. Insert a new Org entry in the a buffer
> 2. M-x org-set-tags-command
> 3. At the prompt enter "one,two,three"
> 4. Entry's tags are correctly set to :one:two:three:
>
> org-capture-fill-template:
> 1. evaluate (org-capture-fill-template "%^g")
> 2. At the prompt enter "one,two,three"
> 3. String returned is incorrect: ":one,two,three:"

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.

If we want the other behavior (invalid tag characters can separate
tags), then it's also a simple matter of changing crm-separator wherever
only tags are completed to recognize all invalid tag characters.

There's also the option to only allow ":" and "," as separators.

> Note this does not change the case of org-todo-list, which binds
> crm-separator to "|". I chose not to touch that because I'm not
> fully aware
> of what the restrictions on characters for todo-keywords are, if
> any.
> org-todo-list also does the right thing by mentioning the
> separator in the prompt.

Agreed, org-todo-list is out of scope.

>
> We could also combine the approaches:
>
> - Introduce a defcustom that determines if we're going to
>   contextually rebind crm-separator
> - Use a broader regexp when contextually binding crm-separator
> - Mention the separator in the prompt when rebound

Whichever behavior we choose, I don't think it's worth making it customizable.

>
> Thoughts?
>
>
> Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+
> Version 3.24.30, cairo version 1.17.4)
>  of 2021-08-02
> Package: Org mode version 9.4.6 (9.4.6-g366444 @
> /home/n/.emacs.d/straight/build/org/)



reply via email to

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