From 3eed03beb733407f46e7d6bf923108ddb223e5a5 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 29 Aug 2023 19:04:12 -0600 Subject: [PATCH] [Emacs] Use org-wild-notifier --- dotfiles/emacs.d/org-config.org | 57 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/dotfiles/emacs.d/org-config.org b/dotfiles/emacs.d/org-config.org index 1ec977fa..4698ef6c 100644 --- a/dotfiles/emacs.d/org-config.org +++ b/dotfiles/emacs.d/org-config.org @@ -184,6 +184,14 @@ We're going to use this to write separate parts of our config to different secti (org-priority-down))) nil 'agenda)) + +(cl-defun imalison:org-at-time (&optional time &key (fn 'org-wild-notifier-check)) + (interactive) + (setq time (or time (time-convert (encode-time (parse-time-string (org-read-date))) 'list))) + (message "%s" time) + (flet + ((current-time (&rest args) time)) + (funcall fn))) #+end_src ** Miscellaneous #+begin_src emacs-lisp :tangle org-config-config.el @@ -838,38 +846,27 @@ alphanumeric characters only." (org-roam-ui-update-on-save t) (org-roam-ui-open-on-start nil)) #+end_src -** org-notify - #+BEGIN_SRC emacs-lisp -(use-package org-notify +** org-wild-notifier +#+begin_src emacs-lisp +(use-package org-wild-notifier :after org + :custom + ((org-wild-notifier-keyword-whitelist nil) + (org-wild-notifier-tags-blacklist '("nonotify"))) :config - (progn - - (setq org-show-notification-handler 'org-notify-action-notify) - - (org-notify-add 'default - '(:time "0s" - :period "2m" :duration 60)) - (org-notify-add 'urgent-second '(:time "3m" :actions (-notify/window -ding) - :period "15s" :duration 10)) - (org-notify-add 'minute '(:time "5m" :actions -notify/window - :period "100s" :duration 70)) - (org-notify-add '12hours - '(:time "3m" :actions (-notify/window -ding) - :period "15s" :duration 10) - '(:time "100m" :actions -notify/window - :period "2m" :duration 60) - '(:time "12h" :actions -notify/window :audible nil - :period "10m" :duration 200)) - (org-notify-add '5days - '(:time "100m" :actions -notify/window - :period "2m" :duration 60) - '(:time "2d" :actions -notify/window - :period "15m" :duration 100) - '(:time "5d" :actions -notify/window - :period "2h" :duration 200)) - (org-notify-start 10))) - #+END_SRC + (org-wild-notifier-mode +1) + (defun org-wild-notify-check-at-time () + (interactive) + (imalison:org-at-time + nil + :fn (lambda () + (-each + (->> (funcall (org-wild-notifier--retrieve-events)) + (-map 'org-wild-notifier--check-event) + (-flatten) + (-uniq)) + 'org-wild-notifier--notify))))) +#+end_src ** org-reveal #+BEGIN_SRC emacs-lisp (use-package ox-reveal