alphapapa / org-super-agenda

Supercharge your Org daily/weekly agenda by grouping items

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use simple lisp expressions for :deadline

purplefishies opened this issue · comments

A simple lisp expression isn't available for the :deadline + "before" arguments.

For instance, a simple expression like

:deadline ( before (org-read-date nil nil "+7"))

Should allow a user to list deadlines that are within 7 days of today. The documentation states

Argument may also be given like before DATE or after DATE where DATE is a date string that org-time-string-to-absolute can process.

The output of (org-read-date nil nil "+7") is this exact format.

If you want to inline the value to which an expression evaluates, you can do that by backquoting the list and splicing the value, like any other Lisp list. The variable org-super-agenda-groups is a list, and its elements are not evaluated by org-super-agenda.

Hi, I've tried something as simple as

(:name "Due Soon" 
     :deadline `(before ,(format "%s"  "2022-12-17")))

And it doesn't work. None of the categories get captured by "Due Soon"...

Comparing that to just

(:name "Due Soon" :deadline (before "2022-12-17"))

Which does capture the deadline items before 2022-12-17

Saw my problem...it's in the way I initialized org-agenda-custom commands...things work with

(setq org-agenda-custom-commands
      `(("a" "agenda"
...
(:name "Due Soon" 
     :deadline (before ,(format "%s"  "2022-12-17")))

FYI, there's no need to use backquoting and splicing with the expression (format "%s" "2022-12-17"), because it's the same as just inlining the string "2022-12-17" directly. The case in which you might want to backquote and splice would be to, e.g. use org-read-date for a relative date.

But when doing that, you need to be aware of when the evaluation happens; e.g. if you set the variable org-super-agenda-groups globally on the 17th, and kept using that Emacs session into the next day, the date in the list would not automatically update to the 18th.

Also, for that specific use case, see #225 and #149.