emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: Tim Landscheidt <tim@tim-landscheidt.de>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia)
Date: Tue, 24 Nov 2020 19:00:49 -0500	[thread overview]
Message-ID: <CA+G3_PNrdhx0Ejzw8UO7DgZ+ju1B7Ar_eTch5MMViEpKGwqq3w@mail.gmail.com> (raw)
In-Reply-To: <87k0uauxw3.fsf@passepartout.tim-landscheidt.de>

Tim,
    Thank for the report, and the digging for ob-langs that might be
affected. The underlying issue is that prologue and epilogue are part
of both the user facing parts of org babel as well as the internal
language implementation facing code. This is a fundamental design flaw
in org babel that needs to be fixed. I have been working on writing up
and diagraming a potential solution for community feedback, but it is
not quite ready yet. Thus, I'm filing this thread along with the
others that I have been compiling about org babel issues. Best!
Tom

On Tue, Nov 24, 2020 at 6:40 PM Tim Landscheidt <tim@tim-landscheidt.de> wrote:
>
> 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-25  0:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=CA+G3_PNrdhx0Ejzw8UO7DgZ+ju1B7Ar_eTch5MMViEpKGwqq3w@mail.gmail.com \
    --to=tgbugs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tim@tim-landscheidt.de \
    /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).