emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Genovese <genovese@cmu.edu>
To: emacs-orgmode@gnu.org
Subject: new tag query parser [2/5] -- some bugs/limitations in the current parser
Date: Wed, 15 Aug 2012 23:59:11 -0400	[thread overview]
Message-ID: <CAPum5FiFPoCa73k4er64jdXmdzd3WA=gcYGnPj_+7hZ7e9PF3A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]

1. Property names with -'s are not handled properly

   Specifically, the escapes are not removed.

   Ex: (org-make-tags-matcher "PROP\\-WITH\\-HYPHENS=2") produces

   ("PROP\\-WITH\\-HYPHENS=2" and
    (progn
    (setq org-cached-props nil)
    (=
     (string-to-number
      (or (org-cached-entry-get nil "PROP\\-WITH\\-HYPHENS")
      ""))
     2))
    t)

   The property name in the matcher should be "PROP-WITH-HYPHENS".
   The original code /does/ instead remove -'s from tag names, which
   shouldn't have them anyway. I suspect that this was intended for
   property names rather than tag names.

2. Incorrect comparison operators allowed, produce bad matchers.

   The regular expression "[<=>]\\{1,2\\}" is used to detect the
   comparison operators. But this can produce bad matchers that fail
   opaquely at match time rather than giving an appropriate error
   message at parse time.

   Ex: (org-make-tags-matcher "P<<2") produces

    ("P<<2" and
     (progn
       (setq org-cached-props nil)
       (nil
        (string-to-number (or (org-cached-entry-get nil "P") "")) 2))
     t)

3. A faulty test for todo matcher in org-make-tags-matcher

   The current code uses (string-match "/+" match)
   to detect the presence of the shortcut /!? style todo matchers.
   But this is insufficient.

   Ex: (org-make-tags-matcher "PROP={^\\s-*// .*$}") produces
   an erroneous matcher:

       ("PROP={^\\s-*// .*$}" progn
        (setq org-cached-props nil)
        (member "PROP" tags-list))

   We want to find the first slash that is not enclosed in {}'s or
   ""'s; if found, a todo match is needed. A simple pattern
   will not be enough for this.

   As a side note, org allows arbitrary characters in TODO keywords,
   (For instance, both PROP={/!} and PROP="/!{/!}" are valid TODO
   keywords (it works!) *and* valid property comparisons.)
   The assumption of the current version is that {}'s and "'s
   are excluded.  I also exclude ()'s from TODO keywords in the
   new version for reasons we can discuss later. Neither seems
   like a big loss. If you are using {}'s, "'s, or ()'s in your
   TODO keywords, use a TODO= match rather than a /!? match.

4. Regexp matchers in todo queries fail when no TODO for an item.

   Ex: (org-make-tags-matcher "/{\\S-}") produces

      ("/{\\S-}" and t (string-match "\\S-" todo))

   This will raise an error when todo is nil (no todo keyword on a
   scanned item) when doing an org-map-entries, say. The todo should be
   replaced with a (or todo "") as it is for tag-style TODO queries.

5. A minor consistency issue

   At line 7179 in org.el (v 7.8.11), missing an org-re call in a
   regex that uses posix classes. The org-re is used elsewhere,
   for xemacs compatibility, I think.


[FWIW, all of these are problems eliminated or made moot in the new parser.]

[-- Attachment #2: Type: text/html, Size: 10763 bytes --]

                 reply	other threads:[~2012-08-16  3:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAPum5FiFPoCa73k4er64jdXmdzd3WA=gcYGnPj_+7hZ7e9PF3A@mail.gmail.com' \
    --to=genovese@cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).