emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: No Wayman <iarchivedmywholelife@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <80pmtqp2wx.fsf@felesatra.moe> (raw)
In-Reply-To: <87a6l4b0bx.fsf@gmail.com> (No Wayman's message of "Thu, 26 Aug 2021 13:04:20 -0400")

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/)


  parent reply	other threads:[~2021-09-03  6:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 17:04 [BUG] [BUG] inconsistent behavior when reading multiple tags [9.4.6 (9.4.6-g366444 @ /home/n/.emacs.d/straight/build/org/)] No Wayman
2021-08-31 10:17 ` Timothy
2021-09-03  2:05   ` No Wayman
2021-09-03  7:22     ` Timothy
2021-09-03 17:00       ` No Wayman
2021-09-03  6:51 ` Allen Li [this message]
2021-09-03  8:08   ` Timothy
2021-09-03 19:20     ` No Wayman
2021-09-17 17:09     ` No Wayman
2021-09-03 17:13   ` No Wayman
2021-09-03 19:42     ` No Wayman
2021-09-03 23:37       ` No Wayman
2021-09-27  8:35         ` Bastien
2021-09-27 15:19           ` No Wayman
2021-09-27 15:49             ` Bastien
2021-09-27 15:56               ` No Wayman
2021-09-06  0:48     ` Allen Li
2021-09-06 23:23       ` No Wayman
2021-09-12  3:37         ` Allen Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80pmtqp2wx.fsf@felesatra.moe \
    --to=darkfeline@felesatra.moe \
    --cc=emacs-orgmode@gnu.org \
    --cc=iarchivedmywholelife@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).