Skip to content

Commit

Permalink
Relative dates in dedalines and scheluded for before and after
Browse files Browse the repository at this point in the history
Backward compatible improvement, org-read-date support a super-set of
the previous function org-time-string-to-absolute.
  • Loading branch information
Daniele Pizzolli committed Apr 24, 2020
1 parent dd0d104 commit bc1a96e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,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 @@ -206,7 +206,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
14 changes: 8 additions & 6 deletions org-super-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ 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. Note that relative dates are supported, e.g. `before
+3d' means in the next two days."
:section-name (pcase (car args)
('t "Deadline items")
('nil "Items without deadlines")
Expand All @@ -442,7 +443,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 @@ -463,8 +464,9 @@ 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. Note that relative dates are supported, e.g. `before
+3d' means in the next two days."
:section-name (pcase (car args)
('t "Scheduled items")
('nil "Unscheduled items ")
Expand All @@ -479,7 +481,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
2 changes: 1 addition & 1 deletion org-super-agenda.info
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ list.
‘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.
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
Expand Down
7 changes: 7 additions & 0 deletions test/test.org
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ I don't know when I'll get to this, so it's undated.
(org-super-agenda-groups
'((:scheduled (before "2017-07-06")))))
(org-agenda nil "a")))

(with-org-today-date "2017-07-05 00:00"
(let ((org-agenda-files (list "~/src/org-super-agenda/test/test.org"))
(org-agenda-span 'day)
(org-super-agenda-groups
'((:scheduled (before "+2d")))))
(org-agenda nil "a")))
#+END_SRC

#+BEGIN_SRC elisp
Expand Down

0 comments on commit bc1a96e

Please sign in to comment.