From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MELlOY6jTGCTRwAA0tVLHw (envelope-from ) for ; Sat, 13 Mar 2021 11:35:42 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sMCfNY6jTGB2YgAAB5/wlQ (envelope-from ) for ; Sat, 13 Mar 2021 11:35:42 +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 aspmx2.migadu.com (Postfix) with ESMTPS id E0C402A6EE for ; Sat, 13 Mar 2021 12:35:41 +0100 (CET) Received: from localhost ([::1]:36096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL2YV-0004fC-TT for larch@yhetil.org; Sat, 13 Mar 2021 06:35:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL2Xa-0004et-8n for emacs-orgmode@gnu.org; Sat, 13 Mar 2021 06:34:42 -0500 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:39406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lL2XY-0004m4-Gq for emacs-orgmode@gnu.org; Sat, 13 Mar 2021 06:34:42 -0500 Received: by mail-qk1-x732.google.com with SMTP id g185so27097022qkf.6 for ; Sat, 13 Mar 2021 03:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:date:message-id:mime-version; bh=5+6Pkgmh/hLz3CFldxxslhN1fSVqrxZ+hqHzwo86uE8=; b=k4VX5V5gcF7Vww/mTbxX314lNWzLJ7J6ZXKIME3Xma5vrScKfnZ4Lej4g0kb/LnEQQ u3h3n0PTqNSQKY6gv/IIBKcyroqni+xEIvVE4dcl2PM4CXvdaf9oUnb5tGooeveu+e5l degb6JGIjpta/mZLSNswPe8o1ERNqNSG/m9jbQoAzScuRF45MJqh/P2SN05dKemFERJm ZN6trW40M/i9t7tm6LlnLoEHrR86+RmMT/8sGDQc2hrWT3P3Vuy8YU8t1GNvrru+oTtV F/rfugk31Lf144Zh5BGjVNIvyOrNbkvjusafRvcYaGEc7IagM0/dolpe8jB0pNgc376E AetA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=5+6Pkgmh/hLz3CFldxxslhN1fSVqrxZ+hqHzwo86uE8=; b=o69W8zZK1Kv/kyAsUE6OVOFsigRuDFsBllW1RZoCta7waz1V2zah58DuCDHkQ9rtcq jA2q22f41b87KhYMJECjwzyDcRhxWAQKlzsr9DTcuYeyIYlAq29+AkS0+zFa9ROvfcC8 n92XU3/TR8xkvlcVPRGgrlhbb6Afmlc/HiPKQiOwpGvqY4RxyrWWmONvkluF2gokYffg cQ0TwfTkgvVt2bQUIgGuf8XQkzEzFu1NInpi8wD22QGj5ZI/ea5K3RsePFDrGLtROhoN FXQyL5ft1IlvEC+EphVwFeATvw75DTrTqRDWzeaRZ1pvIE3neBK8jIyIBQgOPpXEu8Lc 7UAQ== X-Gm-Message-State: AOAM532fD2tfcBOmS54lYNe8aNfF65nDfdhDcnNtKwU5b7kvTO1nli/j hoNXlyCftRwnQOvT3IXsMpifuEkKSGI= X-Google-Smtp-Source: ABdhPJzP+Sk8pO3+K5oBXOfHGwgT4wFFP4YgowMdrvqQpy3Ok4AgBcaS8iOSbfysnf8cwaxncpkYRg== X-Received: by 2002:a05:620a:16d4:: with SMTP id a20mr16809861qkn.410.1615635278686; Sat, 13 Mar 2021 03:34:38 -0800 (PST) Received: from localhost ([190.239.232.210]) by smtp.gmail.com with ESMTPSA id n136sm6567238qke.123.2021.03.13.03.34.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 03:34:38 -0800 (PST) User-agent: mu4e 1.4.14; emacs 27.1 From: Rodrigo Morales To: emacs-orgmode@gnu.org Subject: [bug] :prologue and :epilogue header arguments don't work in latex code blocks Date: Sat, 13 Mar 2021 06:30:30 -0500 Message-ID: <87ft0zl295.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615635342; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5+6Pkgmh/hLz3CFldxxslhN1fSVqrxZ+hqHzwo86uE8=; b=t692zy2VMWjw19dxAoHzL2KaawZEmOBJmZg5LbkutTgQcWZVD0e1laTEIFAfLSnbsJjdTq ub+L43vWSyZFgUTqAQp3Br8FSSoaEYDMaCEHgqHYw7oMfqSPTZoWSEzvCOf6hGQHYjEKXz F6fDvrd1wtdHbN/EFhQniDZU1n6r3zzYv0T1ldVC4oCQdaSH/HAu7XF/G7guobUQxwV2f1 hbGsbg0fHsEN1SU+kloGHw3Y2Ck1uV84XzhgeMAyquOWsAE4TORXt09E2C7xAL/bTnVL8O NgRiH6YNYcfXBVXSxLIeKHsEXTp7YCOK7O9nIk09JDu6ki/59LJEVOtplejBNw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615635342; a=rsa-sha256; cv=none; b=DnyroscWUgjntpo6sRSVASR7Bdhr9mRsyCKq2LVcpodZi0Ka2ZT9+7+8mqwu+q+1S5a2HE PU4dv5oul9GQc2MVvHHuIAzinu63rHCQuDp8QCg+XqyJ79LUxLo8hq48sXJu50iIaoj6lM HwQakEoDcFKjDenIzNK0Nw77rtr06jiVBbZtJKl/cMB/j/1HuM/Gx5Vb/YXNvkWP5Xy1Qm 841m3HNRB4L2nraKpG24ZRIAUwPSH35ZdKrwC1m3apFnU/ZNjt8zXKZdOEU/PULgmmR6t3 k8jU28H/SvEyQmfy6p6HFbaZsKHR/bGqwiGtacjG4iqY4QmY1jcgjm8Rkvah1A== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=k4VX5V5g; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx2.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-Migadu-Spam-Score: -1.59 Authentication-Results: aspmx2.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=k4VX5V5g; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx2.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-Migadu-Queue-Id: E0C402A6EE X-Spam-Score: -1.59 X-Migadu-Scanner: scn0.migadu.com X-TUID: DGrlNuDDqUOE This message can be read easier with Org Mode. * TL; DR: The issue I've noticed that the =:prologue= and =:epilogue= header arguments don't work in code blocks whose language is =latex=. I usually take notes on the =latex= programming language (this is different than taking notes using LaTeX) and having those header arguments would be really helpful for me and, I suppose, other LaTeX programmers. The following lines of this message give more detail on the issue and more information I gathered through experimentation so that Org Mode developers that might be interested in fixing this issue have more information. * Terminology used in this message The following two code blocks will be used to explain the issue. #+begin_src elisp (defun org-babel-tangle-previous-src-block-and-echo () "Tangles the backward nearest source code block and print the content of the tangled file." (save-excursion (goto-char (search-backward-regexp "^[[:space:]]*#\\+begin_src\\>")) (let ((current-prefix-arg '(4))) (call-interactively 'org-babel-tangle)) (let ((filename-tangled (shell-quote-argument (expand-file-name (cdr (assq :tangle (nth 2 (org-babel-get-src-block-info)))))))) (shell-command-to-string (concat "cat " filename-tangled))))) #+end_src #+name: org-babel-tangle-previous-src-block-and-echo #+begin_src elisp (org-babel-tangle-previous-src-block-and-echo) #+end_src * Languages where these header argument work The =:prologue= and =:epilogue= header argument work in =bash= code blocks. #+begin_src bash :tangle ~/Downloads/main.txt :prologue "echo a" :epilogue "echo c" echo This is a bash code block #+end_src #+RESULTS: #+begin_example a This is a bash code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example #!/bin/bash echo a echo This is a bash code block echo c #+end_example They also work in =python= code blocks. #+begin_src python :tangle ~/Downloads/main.txt :prologue "print('a')" :epilogue "print('c')" print('This is a python code block') #+end_src #+RESULTS: #+begin_example a This is a python code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print('a') print('This is a python code block') print('c') #+end_example They also work in =R= code blocks. #+begin_src R :tangle ~/Downloads/main.txt :prologue "print('a')" :epilogue "print('b')" print('This is a R code block') #+end_src #+RESULTS: #+begin_example [1] "a" [1] "This is a R code block" [1] "b" #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print('a') print('This is a R code block') print('b') #+end_example They also work in =maxima= code blocks. #+begin_src maxima :tangle ~/Downloads/main.txt :prologue "print(\"a\");" :epilogue "print(\"c\");" print("This is a maxima code block"); #+end_src #+RESULTS: #+begin_example a This is a maxima code block c #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example print("a"); print("This is a maxima code block"); print("c"); #+end_example * Languages where these header arguments don't work However, these header argument don't work in =latex= code blocks. #+begin_src latex :tangle ~/Downloads/main.txt :prologue "a" :epilogue "c" This is a latex code block #+end_src #+RESULTS: #+begin_example This is a latex code block #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example This is a latex code block #+end_example They also don't work in =cpp= code blocks #+begin_src cpp :tangle ~/Downloads/main.txt :prologue "a" :epilogue "b" :includes "" std::cout << "This is a C++ code block"; #+end_src #+RESULTS: #+begin_example This is a C++ code block #+end_example #+call: org-babel-tangle-previous-src-block-and-echo() #+RESULTS: #+begin_example #include int main() { std::cout << "This is a C++ code block"; return 0; } #+end_example * Additional information In 2020, the user Tim Landscheidt created a [[https://orgmode.org/list/CA+G3_PNrdhx0Ejzw8UO7DgZ+ju1B7Ar_eTch5MMViEpKGwqq3w@mail.gmail.com/T/#t][thread]] in the Org Mode mailing list asking why these header argument don't work in SQL code blocks. In a response to this thread, the user Tom Gillespie mentioned that he had been working in a potential solution. If anyone knows the progress on this, I would also apppreciate some information. -- Greetings, Rodrigo Morales.