Hello, Eric S Fraga <e.fr...@ucl.ac.uk> writes:
> On Tuesday, 24 Jan 2017 at 14:14, Michael Welle wrote: >> ohschockschwerenot, I found it. I set org-confirm-babel-evaluate to a >> function that does look at the body of the code block and then decides >> if it should be executed without confirmation or not. >> >> I'm not sure, why that is a problem. In the case of the examples, the >> function returns t and that is the default value of o-c-b-evaluate. > > Interesting. I cannot help with this but I would be quite interested in > seeing your function in case it's something I could use! Would it be > possible to share? it's quite a hack. I don't want Org to evaluate source code blocks without confirmation. This could lead to all sorts of trouble. On the other hand, there are a few source code blocks, that I want to eval without confirmation. So I use this: (defun hmw/org-post-publish-export-confirm-evaluate (lang body) (not (string-match "^#post publish exporter" body))) (setq org-confirm-babel-evaluate 'hmw/org-post-publish-export-confirm-evaluate) A source code block looks like follows: #+BEGIN_SRC shell :exports results :shebang #!/bin/sh :var SRCDIR=(expand-file-name (plist-get plist :base-directory)) :var DESTDIR=(expand-file-name (plist-get plist :publishing-directory)) #post publish exporter ( echo "Starting esxwithforeman.org $(date)" cd ${SRCDIR} .... echo "Finish esxwithforeman.org $(date)" ) >> /tmp/c0t0d0s0_publish.log 2>&1 #+END_SRC As you can see, this is not a security feature, esp. now that I published it ;). Regards hmw