Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use simple lisp expressions for :deadline #235

Closed
purplefishies opened this issue Nov 14, 2022 · 4 comments
Closed

Can't use simple lisp expressions for :deadline #235

purplefishies opened this issue Nov 14, 2022 · 4 comments

Comments

@purplefishies
Copy link

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.

@alphapapa
Copy link
Owner

alphapapa commented Nov 17, 2022

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.

@purplefishies
Copy link
Author

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

@purplefishies
Copy link
Author

purplefishies commented Nov 18, 2022

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")))

@alphapapa
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants