Hello all,

I am trying to evaluate source blocks under certain heading when their
TODO state changes.  This is what I have so far to test it:

#+BEGIN_SRC emacs-lisp
(defun my-run-babel-on-todo (plist)
  "When TODO state changes, run all source blocks below heading"
  (let* ((element (org-element-at-point))
         (babel-p (org-element-property :TRIGGER_BABEL element)))
    (when babel-p
      (princ "This gets run alright, but not the next one")
      (org-babel-execute-subtree))))
#+END_SRC

#+BEGIN_SRC emacs-lisp
(add-hook 'org-trigger-hook 'my-run-babel-on-todo)
#+END_SRC

* TODO test
:PROPERTIES:
:TRIGGER_BABEL: t
:END:

#+BEGIN_SRC calc
  1 + 1
#+END_SRC

As hinted at in the (princ ...), org-babel-execute-subtree is not run.
Am I missing something?


Best Regards,
Fabio Leimgruber

Attachment: signature.asc
Description: PGP signature

Reply via email to