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

Add relative dates to :deadline and :scheduled #180

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ These selectors take one argument alone, or multiple arguments in a list.
+ =:category= :: Group items that match any of the given categories. Argument may be a string or list of strings.
+ =:children= :: Select any item that has child entries. Argument may be ~t~ to match if it has any children, ~nil~ to match if it has no children, ~todo~ to match if it has children with any to-do keywords, or a string to match if it has children with certain to-do keywords. You might use this to select items that are project top-level headings. Be aware that this may be very slow in non-daily/weekly agenda views because of its recursive nature.
+ =:date= :: Group items that have a date associated. Argument can be =t= to match items with any date, =nil= to match items without a date, or =today= to match items with today’s date. The =ts-date= text-property is matched against.
+ =:deadline= :: Group items that have a deadline. Argument can be ~t~ (to match items with any deadline), ~nil~ (to match items that have no deadline), ~past~ (to match items with a deadline in the past), ~today~ (to match items whose deadline is today), or ~future~ (to match items with a deadline in the future). 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.
+ =:deadline= :: Group items that have a deadline. Argument can be ~t~ (to match items with any deadline), ~nil~ (to match items that have no deadline), ~past~ (to match items with a deadline in the past), ~today~ (to match items whose deadline is today), or ~future~ (to match items with a deadline in the future). Argument may also be given like ~before DATE~ or ~after DATE~ where DATE is a date string that ~org-read-date~ can process.
+ =:effort<= :: Group items that are less than (or equal to) the given effort. Argument is a time-duration string, like ~5~ or ~0:05~ for 5 minutes.
+ =:effort>= :: Group items that are higher than (or equal to) the given effort. Argument is a time-duration string, like ~5~ or ~0:05~ for 5 minutes.
+ ~:file-path~ :: Group items whose buffers' filename paths match any of the given regular expressions.
Expand All @@ -205,7 +205,7 @@ These selectors take one argument alone, or multiple arguments in a list.
+ =:priority<= :: Group items that are lower than the given priority, e.g. ~A~.
+ =:priority<== :: Group items that are lower than or equal to the given priority, e.g. ~B~.
+ =:regexp= :: Group items that match any of the given regular expressions.
+ =:scheduled= :: Group items that are scheduled. Argument can be ~t~ (to match items scheduled for any date), ~nil~ (to match items that are not schedule), ~past~ (to match items scheduled for the past), ~today~ (to match items scheduled for today), or ~future~ (to match items scheduled for the future). 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.
+ =:scheduled= :: Group items that are scheduled. Argument can be ~t~ (to match items scheduled for any date), ~nil~ (to match items that are not schedule), ~past~ (to match items scheduled for the past), ~today~ (to match items scheduled for today), or ~future~ (to match items scheduled for the future). Argument may also be given like ~before DATE~ or ~after DATE~ where DATE is a date string that ~org-read-date~ can process.
+ =:tag= :: Group items that match any of the given tags. Argument may be a string or list of strings.
+ =:time-grid= :: Group items that appear on the time grid.
+ =:todo= :: Group items that match any of the given TODO keywords. Argument may be a string or list of strings, or ~t~ to match any keyword, or ~nil~ to match only non-todo items.
Expand Down
9 changes: 9 additions & 0 deletions examples.org
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ Let's say it's approaching the start of a new school year, and you want to see a

Of course, you could also write that as a standard agenda command with the [[http://orgmode.org/worg/org-tutorials/advanced-searching.html][advanced searching syntax]], and it would execute faster.

Perhaps you want to see all tasks due within the next two weeks? You can use relative date notation like this:

#+BEGIN_SRC elisp :results none
(let ((org-super-agenda-groups
'((:deadline (before "+2w"))
(:discard (:anything t)))))
(org-todo-list))
#+END_SRC

What if you wanted to group tasks that are due before the end of the current month? You could use something like this:

#+BEGIN_SRC elisp
Expand Down
10 changes: 4 additions & 6 deletions org-super-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ match items that have no deadline), `past` (to match items with a
deadline in the past), `today' (to match items whose deadline is
today), or `future' (to match items with a deadline in the
future). 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."
DATE', where DATE is a date string that `org-read-date' can process."
:section-name (pcase (car args)
('t "Deadline items")
('nil "Items without deadlines")
Expand All @@ -450,7 +449,7 @@ DATE', where DATE is a date string that
(org-today))))
(target-date (pcase (car args)
((or 'before 'on 'after)
(org-time-string-to-absolute (cadr args))))))
(org-time-string-to-absolute (org-read-date nil nil (cadr args)))))))
:test (org-super-agenda--when-with-marker-buffer (org-super-agenda--get-marker item)
(let ((entry-time (org-entry-get (point) "DEADLINE")))
(pcase (car args)
Expand All @@ -471,8 +470,7 @@ Argument can be `t' (to match items scheduled for any date),
items scheduled for the past), `today' (to match items scheduled
for today), or `future' (to match items scheduled for the
future). 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."
DATE', where DATE is a date string that `org-read-date' can process."
:section-name (pcase (car args)
('t "Scheduled items")
('nil "Unscheduled items ")
Expand All @@ -487,7 +485,7 @@ DATE', where DATE is a date string that
(org-today))))
(target-date (pcase (car args)
((or 'before 'on 'after)
(org-time-string-to-absolute (cadr args))))))
(org-time-string-to-absolute (org-read-date nil nil (cadr args)))))))
:test (org-super-agenda--when-with-marker-buffer (org-super-agenda--get-marker item)
(let ((entry-time (org-entry-get (point) "SCHEDULED")))
(pcase (car args)
Expand Down