org-wild-notifier.el icon indicating copy to clipboard operation
org-wild-notifier.el copied to clipboard

org-wild-notifier-keyword-whitelist does not respect custom org-todo-keywords

Open codetrick opened this issue 4 years ago • 2 comments

The org-wild-notifier-keyword-... variables do not seem to respect custom org-todo-keywords. Todo items with custom keywords will not trigger notification.

The reason for this is because org-wild-notifier--retrieve-events is run in a separate process by org-wild-notifier-check so all relevant variables have to be pulled in. It is currently not so.

Original function:

(defun org-wild-notifier--retrieve-events ()
  "Get events from agenda view."
  (let ((agenda-files (-filter 'file-exists-p org-agenda-files))
        ;; Some package managers manipulate `load-path` variable.
        (my-load-path load-path)
        (alert-time org-wild-notifier-alert-time)
        (keyword-whitelist org-wild-notifier-keyword-whitelist)
        (keyword-blacklist org-wild-notifier-keyword-blacklist)
        (tags-whitelist org-wild-notifier-tags-whitelist)
        (tags-blacklist org-wild-notifier-tags-blacklist))
    (lambda ()
      (let ((org-agenda-use-time-grid nil)
            (org-agenda-compact-blocks t))
        (setf org-agenda-files agenda-files)
        (setf load-path my-load-path)
        (setf org-wild-notifier-alert-time alert-time)
        (setf org-wild-notifier-keyword-whitelist keyword-whitelist)
        (setf org-wild-notifier-keyword-blacklist keyword-blacklist)
        (setf org-wild-notifier-tags-whitelist tags-whitelist)
        (setf org-wild-notifier-tags-blacklist tags-blacklist)

        (package-initialize)
        (require 'org-wild-notifier)

        (org-agenda-list 2
                         (org-read-date nil nil "today"))

        (->> (org-split-string (buffer-string) "\n")
             (--map (plist-get
                     (org-fix-agenda-info (text-properties-at 0 it))
                     'org-marker))
             (-non-nil)
             (org-wild-notifier--apply-whitelist)
             (org-wild-notifier--apply-blacklist)
             (-map 'org-wild-notifier--gather-info))))))

Fix:

add (todo-keywords org-todo-keywords) in the let clause, and then add (setf org-todo-keywords todo-keywords) below.

P.s. perhaps using async-inject-variables like so will make the code slightly less verbose:

,(async-inject-variables "\\`org-wild-notifier")

codetrick avatar Oct 13 '20 04:10 codetrick

Oh, thank you. Absolutely forgot about this variable. Thanks for the thorough investigation. The fix is on its way.

akhramov avatar Oct 13 '20 04:10 akhramov

On a related note, org-wild-notifier-alert-times-property needs to be pulled in as well.

Your function org-wild-notifier--extract-notication-intervals has a typo in the name.

codetrick avatar Oct 13 '20 04:10 codetrick

Looks like this was fixed Pull in org-todo-keywords when retrieving events (https://github.com/akhramov/org-wild-notifier.el/issues/40) (https://github.com/akhramov/org-wild-notifier.el/issues/55) (https://github.com/akhramov/org-wild-notifier.el/pull/65)

colonelpanic8 avatar Sep 15 '23 06:09 colonelpanic8