emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: emacs-orgmode@gnu.org
Subject: Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia)
Date: Tue, 24 Nov 2020 23:40:28 +0000	[thread overview]
Message-ID: <87k0uauxw3.fsf@passepartout.tim-landscheidt.de> (raw)

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


             reply	other threads:[~2020-11-24 23:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 23:40 Tim Landscheidt [this message]
2020-11-25  0:00 ` Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia) Tom Gillespie

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=87k0uauxw3.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --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).