From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Genovese Subject: new tag query parser [4/5] -- a few ``illuminating'' examples Date: Thu, 16 Aug 2012 00:02:52 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d042f96b641fcee04c75a1fec Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1rIg-0006mi-Mi for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 00:03:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1rIf-0006bU-B6 for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 00:03:14 -0400 Received: from mail-yx0-f169.google.com ([209.85.213.169]:52978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1rIf-0006bL-5B for emacs-orgmode@gnu.org; Thu, 16 Aug 2012 00:03:13 -0400 Received: by yenl1 with SMTP id l1so2810678yen.0 for ; Wed, 15 Aug 2012 21:03:12 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --f46d042f96b641fcee04c75a1fec Content-Type: text/plain; charset=ISO-8859-1 #+TITLE: New Tag Query Parser: A Few Illuminating Examples This post is structured as an org file with the example commands listed within. Copy this to a buffer and try the commands below on that buffer. * Preliminaries Point 207 The Point # labels on the headings give the point values for the beginning of the heading. To make this accurate, we need to standardize tag placemnet. Using M-: or equivalent means, execute the following in this buffer: #+begin_src emacs-lisp (set (make-local-variable 'org-tags-column) -80) (set (make-local-variable 'org-todo-keywords) '((sequence "TODO" "WAIT" "DONE"))) #+end_src If necessary, do C-u C-c on a headline to realign the tags. * Parenthesized Expressions Point 714 :feature: Fully parenthesized expressions are allowed in the tag query strings. A - selector before the parenthesized expression acts as a logical not. These expressions can include an old-style /!? todo-query string as well, which extends to the closing paren. ** TODO Paren Examples Point 1057 :example:paren: + (org-map-entries 'point "(example&HEADING={^Paren}/TODO)") + (org-map-entries 'point "HEADING={Paren} & -(extra | LEVEL = 1)") + (org-map-entries 'point "(feature | LEVEL == 2)({^p}/WAIT|TODO)") The first two should give 1057, the third (1057 1492). * Another Point 1411 :extra: ** WAIT This is not a feature example Point 1492 :pretend: ** We can manipulate and combine whole expressions Point 1573 + (org-map-entries 'point "-(feature&LEVEL=2)") + (org-map-entries 'point "-(feature|LEVEL==2)|{^$}") Note that inheritance can affects the tag matches; it might be nice to be able to distinguish this in searches. Note also that the original matcher fails silently here. * Braces and Spaces AAA Point 1921 :feature: ** DONE Just a marker AAAAAA Point 2002 ** TODO Simple Examples AAAA Point 2042 :example:syntax: + (org-map-entries 'point "example & TODO <> \"DONE\") + (org-map-entries 'point "example/!") + (org-map-entries 'point "example | HEADING = { A\\{{3,4\\}}[^A]}") + Allows = or == for equality operator. ** [#A] Ok Point 2338 ** [#B] This is fast Point 2360 + (org-map-entries 'point "PRIORITY=\"B\"") Many more examples are available in the test suite. Do C-u M-x run-tag-query-tests to see them. --f46d042f96b641fcee04c75a1fec Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable #+TITLE: New Tag Query Pa= rser: A Few Illuminating Examples

This post is structured as an org file = with the example commands listed within.
Copy this to a buffer and= try the commands below on that buffer.

* Preliminaries=A0 Point 207

=A0 The Point # labels on the headings give the poin= t values for the
=A0 beginning of the heading.= To make this accurate, we need to

=A0 standardize tag place= mnet. Using M-: or equivalent means,
=A0 execu= te the following in this buffer:
=A0
=A0 #+begin_src emacs-lisp
=A0 (set (make-local-vari= able 'org-tags-column) -80)
=A0 (set (make= -local-variable 'org-todo-keywords)
=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 '((sequence "TODO" "WAIT" "DONE"))= )
=A0 #+end_src

=A0 If necessary, do C-u C-c on a headline to realig= n the tags.

* Parenthesized Expressio= ns Point 714=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 :feature:

=A0 Fully parenthesized e= xpressions are allowed in the tag query strings.
=A0 A - selector before the parenthesized expression acts as a logical
=A0 not. These expression= s can include an old-style /!? todo-query string
=A0 as well, which extends to the closing paren.

** TODO Paren Examples Point 1057=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= :example:paren:

=A0=A0 + (org-map-entries 'point "(example&= amp;HEADING=3D{^Paren}/TODO)")
=A0=A0 + (org-map-entries= 'point "HEADING=3D{Paren} & -(extra | LEVEL =3D 1)")=A0 =
=A0=A0 + (org-map-entries 'point "(f= eature | LEVEL =3D=3D 2)({^p}/WAIT|TODO)")

=A0=A0 The first two should give 1057, the third (10= 57 1492).
=A0=A0=A0
* Another Point 1411=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 :extra:
** WAIT This is not a feature exam= ple Point 1492=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 :pretend:
** We can manipulate and = combine whole expressions Point 1573

=A0=A0 + (org-map-entries 'point= "-(feature&LEVEL=3D2)")
=A0=A0 + (org-map-entries= 'point "-(feature|LEVEL=3D=3D2)|{^$}")

=A0 Note that inher= itance can affects the tag matches; it might
=A0 be nice to be able to= distinguish this in searches.
=A0 Note also t= hat the original matcher fails silently here.

* Braces and Spaces AAA=A0 Point 1921=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 :feature:
** DONE Just a marker AAA= AAA Point 2002
** TODO Simple Examples AAAA Po= int 2042=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 :example:syntax:
=A0=A0 + (org-map-entries= 'point "example & TODO <> \"DONE\")=A0=A0 + (org-map-entries 'point "example/!&qu= ot;)
=A0=A0 + (org-map-entries= 'point "example | HEADING =3D { A\\{{3,4\\}}[^A]}")=A0=A0 + Allows =3D or =3D=3D for equality operator.
** [#A] Ok Point 2338
** [#B] This is fast Point 2360

=A0=A0 + (org-map-entries 'point "PRIORITY= =3D\"B\"")

Many more examples are av= ailable in the test suite. Do C-u M-x run-tag-query-tests
to see them.

--f46d042f96b641fcee04c75a1fec--