From: Fabio Leimgruber <fabio.leimgruber@posteo.eu>
To: emacs-orgmode@gnu.org
Subject: org-trigger-hook and org-babel-execute-subtree
Date: Sun, 04 Sep 2016 12:56:43 +0200 [thread overview]
Message-ID: <m260qc0w7o.fsf@nirvana.fritz.box> (raw)
[-- 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 --]
next reply other threads:[~2016-09-04 10:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-04 10:56 Fabio Leimgruber [this message]
2016-09-08 23:07 ` org-trigger-hook and org-babel-execute-subtree Fabio Leimgruber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m260qc0w7o.fsf@nirvana.fritz.box \
--to=fabio.leimgruber@posteo.eu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).