From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio Leimgruber Subject: org-trigger-hook and org-babel-execute-subtree Date: Sun, 04 Sep 2016 12:56:43 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgV6q-0002ML-LP for emacs-orgmode@gnu.org; Sun, 04 Sep 2016 06:57:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgV6n-00084p-Iz for emacs-orgmode@gnu.org; Sun, 04 Sep 2016 06:57:08 -0400 Received: from mout02.posteo.de ([185.67.36.66]:53007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgV6n-00084N-CA for emacs-orgmode@gnu.org; Sun, 04 Sep 2016 06:57:05 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id A23A420A45 for ; Sun, 4 Sep 2016 12:56:57 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3sRqYh6bClzyPp for ; Sun, 4 Sep 2016 12:56:54 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlfL/ewACgkQNOHHLtKsq1k/RwCgrIXJDQQAGO9mj7MCKVrmClEt igEAnj17zNl7E4LNqt+yJ10EFSTisPNT =sdk/ -----END PGP SIGNATURE----- --=-=-=--