emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-trigger-hook and org-babel-execute-subtree
@ 2016-09-04 10:56 Fabio Leimgruber
  2016-09-08 23:07 ` Fabio Leimgruber
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Leimgruber @ 2016-09-04 10:56 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 180 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-08 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 10:56 org-trigger-hook and org-babel-execute-subtree Fabio Leimgruber
2016-09-08 23:07 ` Fabio Leimgruber

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).