From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Leech-Pepin Subject: Re: Hotlist agenda view: how to simplify its expression? Date: Fri, 9 Aug 2013 11:54:55 -0400 Message-ID: References: <867gfu3obv.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf307cfec0c5b3c804e385cb3f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7p1l-0007Rc-Vo for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:54:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7p1k-000070-Mh for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:54:57 -0400 Received: from mail-vc0-x22b.google.com ([2607:f8b0:400c:c03::22b]:45290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7p1k-00006p-GU for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:54:56 -0400 Received: by mail-vc0-f171.google.com with SMTP id ij15so1158888vcb.30 for ; Fri, 09 Aug 2013 08:54:55 -0700 (PDT) In-Reply-To: <867gfu3obv.fsf@somewhere.org> 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: Sebastien Vauban Cc: Org Mode Mailing List --20cf307cfec0c5b3c804e385cb3f Content-Type: text/plain; charset=UTF-8 Hello, On Aug 9, 2013 10:57 AM, "Sebastien Vauban" wrote: > > Hello, > > Suppose I want a convenient way to see my most important tasks, the ones > which: > > - are due soon (in the next 7 days), or > - have a high priority (#A), or > - are FLAGGED. > > If I don't mind having the entries mixed, this is quite simple and short: > > #+begin_src emacs-lisp > (add-to-list 'org-agenda-custom-commands > '("H" "Hotlist" > tags-todo "DEADLINE<=\"<+1w>\"|PRIORITY=\"A\"|FLAGGED" > ((org-agenda-todo-ignore-scheduled 'future))) t) > #+end_src > > Though, if I want 3 different blocks (in the above order) with *no repetition* > of entries, I need to write such a monster expression: > > #+begin_src emacs-lisp > (add-to-list 'org-agenda-custom-commands > '("I" "Hotlist" > ((tags-todo "DEADLINE<=\"<+1w>\"" > ((org-agenda-overriding-header "Due in next 7 days"))) > (tags-todo "PRIORITY=\"A\"+DEADLINE=\"\"|PRIORITY=\"A\"+DEADLINE>\"<+1w>\"" > ((org-agenda-overriding-header "High priority"))) > (tags-todo "FLAGGED+PRIORITY=\"\"+DEADLINE=\"\"|FLAGGED+PRIORITY=\"\"+DEADLINE>\"<+1w>\"|FLAGGED+PRIORITY<>\"A\"+DEADLINE=\"\"|FLAGGED+PRIORITY<>\"A\"+DEADLINE>\"<+1w>\"" > ((org-agenda-overriding-header "Starred")))) > ((org-agenda-todo-ignore-scheduled 'future))) t) > #+end_src > > Do you see a way to optimize it (make it shorter)? On the problems relies in > the fact that the inverse of > > DEADLINE<="<+1w>" > > is > > DEADLINE=""|DEADLINE>"<+1w>" > > that is 2 tests to be done. > > The same applies for the priorities: the inverse of > > PRIORITY=\"A\" > > is > > PRIORITY=""|PRIORITY<>"A" > > Hence, an exponential number of checks every time you want to remove > duplicated entries (which would have been displayed in the previous block): > you double the number of subexpressions in the next block... > Could you use (org-agenda-skip-regexp "...") combined with (org-agenda-skip-function (org-agenda-skip-entry-when-regexp-matches)) Just change the ... in the above to the deadline/priority you want to exclude in the block. Sorry if this is at all unclear, sending from my phone so hard to write out the code blocks. Regards, Jon > Any better idea? > > Best regards, > Seb > > -- > Sebastien Vauban > > --20cf307cfec0c5b3c804e385cb3f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hello,

On Aug 9, 2013 10:57 AM, "Sebastien Vauban" <sva-news@mygooglest.com> wr= ote:
>
> Hello,
>
> Suppose I want a convenient way to see my most important tasks, the on= es
> which:
>
> - are due soon (in the next 7 days), or
> - have a high priority (#A), or
> - are FLAGGED.
>
> If I don't mind having the entries mixed, this is quite simple and= short:
>
> #+begin_src emacs-lisp
> =C2=A0 (add-to-list 'org-agenda-custom-commands
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("H&q= uot; "Hotlist"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tags-tod= o "DEADLINE<=3D\"<+1w>\"|PRIORITY=3D\"A\"= |FLAGGED"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((org-ag= enda-todo-ignore-scheduled 'future))) t)
> #+end_src
>
> Though, if I want 3 different blocks (in the above order) with *no rep= etition*
> of entries, I need to write such a monster expression:
>
> #+begin_src emacs-lisp
> =C2=A0 (add-to-list 'org-agenda-custom-commands
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'("I&q= uot; "Hotlist"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((tags-t= odo "DEADLINE<=3D\"<+1w>\""
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((org-agenda-overriding-header "Due = in next 7 days")))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (tags-t= odo "PRIORITY=3D\"A\"+DEADLINE=3D\"\"|PRIORITY=3D\= "A\"+DEADLINE>\"<+1w>\""
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((org-agenda-overriding-header "High= priority")))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (tags-t= odo "FLAGGED+PRIORITY=3D\"\"+DEADLINE=3D\"\"|FLAGG= ED+PRIORITY=3D\"\"+DEADLINE>\"<+1w>\"|FLAGGED+= PRIORITY<>\"A\"+DEADLINE=3D\"\"|FLAGGED+PRIORITY&= lt;>\"A\"+DEADLINE>\"<+1w>\""
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((org-agenda-overriding-header "Star= red"))))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((org-ag= enda-todo-ignore-scheduled 'future))) t)
> #+end_src
>
> Do you see a way to optimize it (make it shorter)? =C2=A0On the proble= ms relies in
> the fact that the inverse of
>
> =C2=A0 =C2=A0 DEADLINE<=3D"<+1w>"
>
> is
>
> =C2=A0 =C2=A0 DEADLINE=3D""|DEADLINE>"<+1w>&qu= ot;
>
> that is 2 tests to be done.
>
> The same applies for the priorities: the inverse of
>
> =C2=A0 =C2=A0 PRIORITY=3D\"A\"
>
> is
>
> =C2=A0 =C2=A0 PRIORITY=3D""|PRIORITY<>"A" >
> Hence, an exponential number of checks every time you want to remove > duplicated entries (which would have been displayed in the previous bl= ock):
> you double the number of subexpressions in the next block...
>
Could you use (org-agenda-skip-regexp "...") combined with (org-a= genda-skip-function (org-agenda-skip-entry-when-regexp-matches))

Just change the ... in the above to the deadline/priority yo= u want to exclude in the block.

Sorry if this is at all unclear, sending from my phone so ha= rd to write out the code blocks.

Regards,
Jon

> Any better idea?
>
> Best regards,
> =C2=A0 Seb
>
> --
> Sebastien Vauban
>
>

--20cf307cfec0c5b3c804e385cb3f--