emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
To: Ihor Radchenko <yantar92@posteo.net>, Samuel Loury <konubinix@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC] Quoting property names in tag/property matches [Was: [BUG?] Matching tags: & operator no more implicit between tags and special property]
Date: Wed, 23 Aug 2023 16:00:13 +0200	[thread overview]
Message-ID: <748acab1-eaf4-fdd3-13a6-26e6229de613@vodafonemail.de> (raw)
In-Reply-To: <811c9bda-cea4-c0d6-30b4-53ebdb432ab6@vodafonemail.de>

> On 2023-08-23  12:31, Ihor Radchenko wrote:
> 
>> Jens, we got an edge case with "-", after all.
>>
>> What is happening here is that the new parser
>> (https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a2367d2@vodafonemail.de)
>> treats the above match string as
>>
>> property "tag-TODO" not equal "TODO"
>>
>> instead of
>>
>> not tag equal "tag" and not TODO equal "TODO"

Right.  And you already provided in the other branch of this
discussion a direction how to resolve that:

> [...] In case of ambiguity TAG1-TAG2-TAG3-PROP="" like we see here, we
> should prefer multiple shorter conditions: TAG1 && -TAG2 && -TAG3 && PROP=""
> 
> When "TAG1-TAG2" is an actual tag name with dash, we may allow escaping.

But I'd like to clarify that.  From the Org syntax

  https://orgmode.org/worg/org-syntax.html#Headings

I understood that tag names cannot contain minus characters,
and `org-tag-re' does not match any, either.  So we are talking
about property names only, right?  At least I'll do so in the
following ...


Then the question is what quoting scheme to use for property
names.  The previous one used before my commit f689eb4

  (A) "\\-" => "-"

never has been documented and never has been working properly,
since the *matching* of these was done on *prop* names, but
the *unescaping* on *tag* names.  So we are basically free to
come up with something new.

Some obvious choice would be a simpler single backslash

  (B) "\-" => "-"

And when I have been "fixing" the parser, I also thought that

  (C) ":...:" => "..."

would give a nice and somewhat logical quoting scheme.  That is,
if a property name contains "special" characters, it could be
surrounded by colons to quote these.

So we have so far quoting schemes A, B, C, with my preference
being C.  Any other proposals?


I'll focus on C, where there is one big cave-at:  The main
regexp in `org-make-tags-matcher' also allows for (undocumented)
colons as inclusive search term separator:

  ;; exclusion and inclusion (the latter being implicit)
  "\\(?1:[-+:]\\)?"
            ^
   
Which collides with the colons used by quoting scheme C.  I'd
rather sacrifice that use of colon as search term separator,
TBH.

Given the property name syntax in

  https://orgmode.org/worg/org-syntax.html#Node_Properties

the subre in `org-make-tags-matcher' to match property names
should then look similar to

  "\\(?5:[[:alnum:]_]+\\|:[^[:space:]]+?:\\)"

, right (colons being stripped off later)?  I'm really asking
about the trailing plus signs here, but these do not seem to
make sense in property queries.


What do you think?



  reply	other threads:[~2023-08-23 16:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  7:57 [BUG?] Matching tags: & operator no more implicit between tags and special property Samuel Loury
2023-08-23 10:21 ` Jens Schmidt
2023-08-23 10:37   ` Ihor Radchenko
2023-08-23 10:31 ` Ihor Radchenko
2023-08-23 10:38   ` Jens Schmidt
2023-08-23 14:00     ` Jens Schmidt [this message]
2023-08-23 15:55       ` [RFC] Quoting property names in tag/property matches [Was: [BUG?] Matching tags: & operator no more implicit between tags and special property] Jens Schmidt
2023-08-24  7:30         ` Ihor Radchenko
2023-08-24  7:32       ` Ihor Radchenko
2023-08-24  8:52         ` Jens Schmidt
2023-08-25 18:46           ` Jens Schmidt
2023-08-26 10:16             ` Ihor Radchenko
2023-08-26 11:53               ` Jens Schmidt
2023-08-26 12:00                 ` Ihor Radchenko
2023-08-26 12:19                   ` Jens Schmidt
2023-08-26 12:22                     ` Ihor Radchenko
2023-08-26 12:54                       ` Jens Schmidt
2023-08-27  7:11                         ` Samuel Loury
2023-08-27  7:43                           ` Ihor Radchenko
2023-09-01 16:48                             ` Jens Schmidt
2023-09-01 23:59                               ` Tom Gillespie
2023-09-02  0:02                                 ` Tom Gillespie
2023-09-02  7:10                               ` Ihor Radchenko
2023-09-02 13:14                                 ` Redoing the current tag/property parser in a real grammar [was: Re: [RFC] Quoting property names in tag/property matches] Jens Schmidt
2023-09-03  7:04                                   ` Ihor Radchenko
2023-09-02 13:18                                 ` [RFC] Quoting property names in tag/property matches Jens Schmidt
2023-08-30 16:28                         ` [RFC] Quoting property names in tag/property matches [Was: [BUG?] Matching tags: & operator no more implicit between tags and special property] Jens Schmidt
2023-08-31  8:08                           ` Ihor Radchenko
2023-08-31 10:24                             ` Jens Schmidt
2023-09-03  6:53                         ` Ihor Radchenko
2023-09-03  9:25                           ` Jens Schmidt

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=748acab1-eaf4-fdd3-13a6-26e6229de613@vodafonemail.de \
    --to=jschmidt4gnu@vodafonemail.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=konubinix@gmail.com \
    --cc=yantar92@posteo.net \
    /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).