emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Is there a way to get all agenda TODOs programmatically?


From: Adam Porter
Subject: Re: [O] Is there a way to get all agenda TODOs programmatically?
Date: Wed, 03 Jan 2018 07:15:11 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi Marcin (and all),

I have some more code you might find useful.  I had an idea to take a
different approach with my org-agenda-ng code (not using org-element to
parse the whole buffer first), and it seems to be working well so far.
The code is here:

https://github.com/alphapapa/org-agenda-ng/tree/non-element-parsing

The code doesn't generate an identical result to the org-agenda code
(not yet, anyway), but it's very similar.  It lacks the agenda prefix
feature and full application of agenda faces (it does do a few faces
already).  Most, if not all, text properties are applied.  And of
course, more work could be done to make it look more like an official
agenda buffer.

So, for an example, you can run code like this to simulate a primitive
agenda buffer:

(org-agenda-ng--agenda
 :files org-agenda-files
 :any `((org-agenda-ng--date-p :date <= ,(org-today))
        (org-agenda-ng--date-p :deadline <= ,(+ org-deadline-warning-days 
(org-today)))
        (org-agenda-ng--date-p :scheduled <= ,(org-today)))
 :none `((apply org-agenda-ng--todo-p ,org-done-keywords)))

Or you could search for certain types of to-do items with a deadline
before a certain date like:

(org-agenda-ng--agenda
 :files "~/org/main.org"
 :all '((org-agenda-ng--todo-p "TODO" "WAITING")
        (org-agenda-ng--date-p :deadline < "2018-01-03")))

As you can see, the :all, :any, and :none arguments are a list of quoted
lisp forms.  You can also give your own lambda, like:

(org-agenda-ng--agenda
 :files org-agenda-files
 :pred (lambda ()
         (and (org-agenda-ng--todo-p)
              (or (org-agenda-ng--date-p :deadline '<= (org-today))
                  (org-agenda-ng--date-p :scheduled '<= (org-today)))
              (not (apply #'org-agenda-ng--todo-p 
org-done-keywords-for-agenda)))))

If you also give :all, :any, or :none, they are AND-ed with the :pred
lambda.

It's all highly experimental and WIP, but feel free to try it out, and
please let me know any feedback you might have.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]