> ... It does > evaluates and I get the result in the message buffer, but it does not > expands in the Org buffer.
It is expected behaviour. According to the docstring of org-sbe, it only returns the value, but does not actually change buffer. If you want to replace the RESULTS, you need to use the following: # Local Variables: # eval: (let ((pos (org-babel-find-named-block "stages"))) (when pos (save-excursion (org-with-point-at pos (org-babel-execute-src-block))))) # End: Best, Ihor Jean Louis <bugs@gnu.support> writes: > * Eric S Fraga <e.fr...@ucl.ac.uk> [2020-11-24 12:46]: >> On Tuesday, 24 Nov 2020 at 12:00, Jean Louis wrote: >> > Can I automated the execution of Babel code upon opening of the Org >> > file? >> >> You can, by using file local variables. For instance, for some files, I >> do this: >> >> #+begin_src org >> ,* local variables :noexport: >> # Local Variables: >> # eval: (org-sbe "startup") >> # End: >> #+end_src > > I have got it to work as I had to name the source block. It does > evaluates and I get the result in the message buffer, but it does not > expands in the Org buffer. That is what I wish to find out how. > > ** Stages > #+NAME: stages > #+BEGIN_SRC sql :engine postgresql :exports results :results replace > SELECT 1 AS table; > #+END_SRC > > # Local Variables: > # eval: (org-sbe "stages") > # End: