spegoraro / org-alert

System notifications of org agenda items
GNU General Public License v3.0
277 stars 25 forks source link

how to make this show alert for yesterday or past tasks that has not completed yet? #40

Open Moanrisy opened 1 month ago

Moanrisy commented 1 month ago

It only work for current date (today).

(use-package org-alert
  :ensure t
  :config
  (setq alert-default-style 'libnotify)
  (setq org-alert-interval 300
      org-alert-notify-cutoff 10
      org-alert-time-match-string "\\(?:SCHEDULED\\|DEADLINE\\):.*\\(?:\\[\\|<\\).*\\([0-9]\\{2\\}:[0-9]\\{2\\}\\).*\\(?:\\]\\|>\\)"
      ;; org-alert-notify-after-event-cutoff 600)
      org-alert-notify-after-event-cutoff 3000)
  (org-alert-enable))

I already set after-event-cutoff into 3000 min too, which means yesterday task should be shown on alert too (1 day is 1440 min)

ntBre commented 1 month ago

Thanks for the report! I think you will also need to modify org-alert-match-string, which has a default value of "SCHEDULED>=\"<today>\"+SCHEDULED<\"<tomorrow>\"|DEADLINE>=\"<today>\"+DEADLINE<\"<tomorrow>\"". This is where the today and tomorrow values are set for the initial search for agenda entries. It sounds like you'll want to add something like <yesterday> here, assuming Org mode supports that. We pass org-alert-match-string to org-map-entries, so the documentation for that function might help you to craft your match string.

I vaguely remember messing with this in the past and having some trouble, but hopefully it will work for you.