From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MDU/GgKfvV+bCgAA0tVLHw (envelope-from ) for ; Wed, 25 Nov 2020 00:02:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yPADFgKfvV+0OAAAB5/wlQ (envelope-from ) for ; Wed, 25 Nov 2020 00:02:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D2BDD9404FE for ; Wed, 25 Nov 2020 00:02:09 +0000 (UTC) Received: from localhost ([::1]:55376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khiG7-0004OF-6E for larch@yhetil.org; Tue, 24 Nov 2020 19:02:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khiF7-0004O1-CW for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 19:01:05 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khiF5-0008Ep-Md for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 19:01:05 -0500 Received: by mail-wr1-x436.google.com with SMTP id z7so178091wrn.3 for ; Tue, 24 Nov 2020 16:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZCaLBxMORZ4cW76J1l9KDLB5GPYVTO132Jt3CZ7bntM=; b=rsOYmDltQOYwQpL9zQ9G2mBHWqRJX/TefLEsVFM/pvBwxZhVWH6/VfYGGQIeuD23cZ EaA4PBOIaCkVPP42CjbTXgDBSpzb4ndSfhTa4181bCV7Wp1PDriilQVP5rm+WtjQQ/BQ bcWyN7cE4ddAZGwZq6zrIyG0pR2FfSAJ5i1t5LS4ghA7Unl4zynhYlmd66uQ4VTBlH5z Cwy2wXi0JzT+fDz/n+9GfuodAHE2Pw1vF8o77zwhkiYtBT6SG/giUm3907Wz8a3zYeqm x/POEmEcErSSbDtgGqVXvavbQmKBfrvy+uyTJoCdjuxUn2qN+o8jqoJWZGX8+nfFLfRR I0Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZCaLBxMORZ4cW76J1l9KDLB5GPYVTO132Jt3CZ7bntM=; b=IgyJj30AOYuTDGcxUWeVecwsl0InkFynrX7vtYw4TY0cYel03hvGDQ2NiukN0UW2c9 4AbPujcYLPAjhLPowZpcLxgHuItkNzlMZDK5yOjkXmCffktnjzjPaGuYa43X4XRAtEBB s/ZENr9g3XIUBgU6qY3ZGN5cw11A8A0emyC+xV9AaxHlHlZVR3gidluiLxWHaxgA4mtK jCHaneRgC6CjlMFCgXR1lj5y2QrZ/DkQQEJQBB1nfBdfNvAPBwY8o8cOOsV/Az58n/P7 VFUNNTpUgmBMACwiLHJHAUQzmQT9mSCGCB+NNWMZJhFjIR9hYTVtGFNNGUuuRURXhvmQ ZPIw== X-Gm-Message-State: AOAM530/QhmQ2a0/hb9ugoQ/L5EcAWMNHXCuoE89vZHOLcjiAF4KXDyY ASAcH4EjnjCvCvwV1NQL5/7aii9/zL/Jst1PvTY= X-Google-Smtp-Source: ABdhPJxDqTVzpg2VrDRi9BGFhvtgUGK2IwNph97WFEigmURUelblrL0Gqo8SACJGmQsVR6bTfyUGfxyXQKH3k4n9Kj0= X-Received: by 2002:a5d:6342:: with SMTP id b2mr965199wrw.67.1606262461287; Tue, 24 Nov 2020 16:01:01 -0800 (PST) MIME-Version: 1.0 References: <87k0uauxw3.fsf@passepartout.tim-landscheidt.de> In-Reply-To: <87k0uauxw3.fsf@passepartout.tim-landscheidt.de> From: Tom Gillespie Date: Tue, 24 Nov 2020 19:00:49 -0500 Message-ID: Subject: Re: Bug: :prologue and :epilogue are ignored in ob-sql code blocks (inter alia) To: Tim Landscheidt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=tgbugs@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=rsOYmDlt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: sA816IT+ZbFr 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 wr= ote: > > With Emacs 27.1/org-mode 9.3, "(org) Environment of a Code > Block" ends with: > > | Inserting headers and footers > | ----------------------------- > > | The =E2=80=98prologue=E2=80=99 header argument is for appending to the = top of the code > | block for execution, like a reset instruction. For example, you may us= e > | =E2=80=98:prologue "reset"=E2=80=99 in a Gnuplot code block or, for eve= ry such block: > | > | (add-to-list 'org-babel-default-header-args:gnuplot > | '((:prologue . "reset"))) > > | Likewise, the value of the =E2=80=98epilogue=E2=80=99 header argumen= t 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=3Daligned -P foote= r=3Don > | 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 >