[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Hotlist agenda view: how to simplify its expression?
From: |
Sebastien Vauban |
Subject: |
Re: [O] Hotlist agenda view: how to simplify its expression? |
Date: |
Mon, 12 Aug 2013 13:58:50 +0200 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt) |
Hello Jonathan,
Jonathan Leech-Pepin wrote:
> On Aug 9, 2013 10:57 AM, "Sebastien Vauban" <address@hidden> wrote:
>> 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 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)?
>
> 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.
I can do it for checking for the PRIORITY cookie (#A), but I can't transform
(the inverse of) DEADLINE<="<+1w>" into a regexp...
Though, here is already a nicer version of the above command:
--8<---------------cut here---------------start------------->8---
(add-to-list 'org-agenda-custom-commands
'("dh" "Hotlist"
;; tags-todo "DEADLINE<=\"<+1w>\"|PRIORITY=\"A\"|FLAGGED"
((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+DEADLINE=\"\"|FLAGGED+DEADLINE>\"<+1w>\""
((org-agenda-overriding-header "Starred")
(org-agenda-skip-regexp "\\[#A\\]")
(org-agenda-skip-function
'(org-agenda-skip-entry-when-regexp-matches)))))
((org-agenda-todo-ignore-scheduled 'future))) t)
--8<---------------cut here---------------end--------------->8---
Thanks!
Best regards,
Seb
--
Sebastien Vauban