emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia)
@ 2020-11-24 23:40 Tim Landscheidt
  2020-11-25  0:00 ` Tom Gillespie
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Landscheidt @ 2020-11-24 23:40 UTC (permalink / raw)
  To: emacs-orgmode

With Emacs 27.1/org-mode 9.3, "(org) Environment of a Code
Block" ends with:

| Inserting headers and footers
| -----------------------------

| The ‘prologue’ header argument is for appending to the top of the code
| block for execution, like a reset instruction.  For example, you may use
| ‘:prologue "reset"’ in a Gnuplot code block or, for every such block:
|
|      (add-to-list 'org-babel-default-header-args:gnuplot
|                   '((:prologue . "reset")))

|    Likewise, the value of the ‘epilogue’ header argument is for
| appending to the end of the code block for execution.

However it appears as if :prologue and :epilogue are ignored
in ob-sql code blocks:

| #+NAME: test-for-ob-sql
| #+BEGIN_SRC sql :engine postgresql :results verbatim :prologue "SELECT 1;" :epilogue "SELECT 5;" :cmdline --no-psqlrc -P format=aligned -P footer=on
|   SELECT 2;
|   SELECT 3;
|   SELECT 4;
| #+END_SRC

| #+RESULTS: test-for-ob-sql
| #+begin_example
|  ?column?
| ----------
|         2
| (1 Zeile)

|  ?column?
| ----------
|         3
| (1 Zeile)

|  ?column?
| ----------
|         4
| (1 Zeile)

| #+end_example

It seems that :prologue and :epilogue are only honoured in
languages that use org-babel-expand-body:generic and a
(very) few others; especially, the following languages prob-
ably ignore them (untested):

| [tim@passepartout ~/src/emacs]$ find lisp/org -type f -name ob-\*.el \
| > -not -exec fgrep -q 'org-babel-expand-body:generic' {} \; \
| > -not -exec fgrep -q ':prologue' {} \; \
| > -print
| lisp/org/ob-C.el
| lisp/org/ob-J.el
| lisp/org/ob-abc.el
| lisp/org/ob-awk.el
| lisp/org/ob-calc.el
| lisp/org/ob-clojure.el
| lisp/org/ob-comint.el
| lisp/org/ob-css.el
| lisp/org/ob-ditaa.el
| lisp/org/ob-dot.el
| lisp/org/ob-ebnf.el
| lisp/org/ob-emacs-lisp.el
| lisp/org/ob-eval.el
| lisp/org/ob-exp.el
| lisp/org/ob-fortran.el
| lisp/org/ob-hledger.el
| lisp/org/ob-latex.el
| lisp/org/ob-ledger.el
| lisp/org/ob-lisp.el
| lisp/org/ob-lob.el
| lisp/org/ob-makefile.el
| lisp/org/ob-matlab.el
| lisp/org/ob-mscgen.el
| lisp/org/ob-org.el
| lisp/org/ob-picolisp.el
| lisp/org/ob-ref.el
| lisp/org/ob-sed.el
| lisp/org/ob-shen.el
| lisp/org/ob-sql.el
| lisp/org/ob-sqlite.el
| lisp/org/ob-table.el
| lisp/org/ob-stan.el
| lisp/org/ob-vala.el


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

end of thread, other threads:[~2020-11-25  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 23:40 Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia) Tim Landscheidt
2020-11-25  0:00 ` Tom Gillespie

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).