Condensed the code a bit

This commit is contained in:
Bram Schoenmakers 2022-11-26 17:42:07 +01:00
parent df72a38bdb
commit 41dbfc90ac
2 changed files with 10 additions and 12 deletions

View file

@ -137,12 +137,11 @@ My vertico-repeat setup.
for a property in the todo item at point and looks for properties
containing code that needs to be executed."
(if-let* ((state org-state)
(event-property-name (concat "ON_" state))
(properties (org-entry-properties))
(code-string (cdr (assoc event-property-name properties)))
(code (car (read-from-string code-string))))
(org-eval code)))
(when-let* ((event-property-name (concat "ON_" org-state))
(code-string (cdr (assoc event-property-name
(org-entry-properties))))
(code (car (read-from-string code-string))))
(org-eval code)))
(add-hook 'org-after-todo-state-change-hook 'my/task-state-event-handler)
,#+end_src

View file

@ -8,12 +8,11 @@ The property should be named =ON_<STATE>= where =STATE= is a state defined in =o
for a property in the todo item at point and looks for properties
containing code that needs to be executed."
(if-let* ((state org-state)
(event-property-name (concat "ON_" state))
(properties (org-entry-properties))
(code-string (cdr (assoc event-property-name properties)))
(code (car (read-from-string code-string))))
(org-eval code)))
(when-let* ((event-property-name (concat "ON_" org-state))
(code-string (cdr (assoc event-property-name
(org-entry-properties))))
(code (car (read-from-string code-string))))
(org-eval code)))
(add-hook 'org-after-todo-state-change-hook 'my/task-state-event-handler)
#+end_src