From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wN2hLmIwzWFESwEAgWs5BA (envelope-from ) for ; Thu, 30 Dec 2021 05:06:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kDkpK2IwzWHXbQAAauVa8A (envelope-from ) for ; Thu, 30 Dec 2021 05:06:58 +0100 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 583ED2EF2E for ; Thu, 30 Dec 2021 05:06:58 +0100 (CET) Received: from localhost ([::1]:46586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2miP-0004cz-4D for larch@yhetil.org; Wed, 29 Dec 2021 23:06:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2mhi-0004ck-Dn for emacs-orgmode@gnu.org; Wed, 29 Dec 2021 23:06:14 -0500 Received: from [2607:f8b0:4864:20::1029] (port=33292 helo=mail-pj1-x1029.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2mhg-00041Z-IS for emacs-orgmode@gnu.org; Wed, 29 Dec 2021 23:06:13 -0500 Received: by mail-pj1-x1029.google.com with SMTP id g11-20020a17090a7d0b00b001b2c12c7273so1004818pjl.0 for ; Wed, 29 Dec 2021 20:06:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=inuR4MK5AFqwJEevRLYP0ekzSvrdPthiIKYNNl90MOY=; b=KRvWr/VmIxy4C4CwZ1AVIIQ7w1Xozmgo9D9+mvfdJFjCT+qpc6eYKSpkmtzUD8At62 SXChhMqYRAI2ldN33M7UQjYCU992yX55q1lzK0ag01gO7DtTs8BQfd7cmJQBVtUqX9jP Z/46SujlHp78GlSt60KZOrxZQqsJKR9xzRj+tDDqgfSVl6vEB7tWmU3hYxL3O1Wd/cdM A/unIrokAPcFD+Wm37v3DlBc19Fo38BQ+QwuhyyVLRQa74pxif8OTqnEPQ6nTxS8iAC5 odiZyjn4NgU1cQclQg4jqn/jRGZcvE3FfkA3Je5wmqiDbn0FBMp04BGZYR6YtDe3lrwZ QTxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=inuR4MK5AFqwJEevRLYP0ekzSvrdPthiIKYNNl90MOY=; b=rEsQh8Gkkk/dXIdxx/nSeZ5ze33GyO6tYUBRT5MVcTpGpPmXZ5LinI+INe4aELu8Fv eS58nflCwTRNSD8C2PNP6utKunivKXi3cCF380t6mbZfd3hCqZQZXY2EB4FvWjIax7gt tFk/Y5vQM7tyAd5TLFydtDG+E2QseL8UHSI+ILveRiuBYRGfNDiPaErjAMoMWdtOPfR1 oVpyO6425jZcRETriP3qnAn1MdCmQz/Pc43MnRJTwEtIHogrKYinssZXOCuAMrI1xqQf 2er7XEM+5AL+EFDEe/y99H/Cgvu3zJYqO8Sy7v0RmmQpHLgdi6IHyKWnrOC59J5LCV4n BEVA== X-Gm-Message-State: AOAM532WqdNiWWt3+sxPzxA0jC62ORs+ajmHuMA/EcXaNk8sk2yRWtW8 lA6x+lfmv1faeplbVIZDmvyVXNd63zQHBGIRbiWQWuEBwJ8= X-Google-Smtp-Source: ABdhPJzZ5KTIjr5kPVbsN5Cxnc8KnQ2qXcnlBfJEdWmp5zgsF5lrEafXoC2MBxMCBGs/IQTk6aQR3TqjIRsLnaVeP7w= X-Received: by 2002:a17:90b:4d07:: with SMTP id mw7mr35549347pjb.43.1640837170454; Wed, 29 Dec 2021 20:06:10 -0800 (PST) MIME-Version: 1.0 From: Matt Huszagh Date: Wed, 29 Dec 2021 20:05:59 -0800 Message-ID: Subject: [PATCH] Fix caption format for custom latex src block To: Emacs-Orgmode Content-Type: multipart/mixed; boundary="000000000000adf0d405d4552c49" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1029 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=huszaghmatt@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640837218; 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=inuR4MK5AFqwJEevRLYP0ekzSvrdPthiIKYNNl90MOY=; b=FsAMTuB2vbaw0Sy0UTgzOIwEsNMnDoELPwafoKm5Lt2rCsnFhhSaNl+zs8OElVlr7UHFJ4 BMfj0BEcq9obpIu/D08n/LIZuuNAJAlY4F+7VgpTNQtgPsbDS3vFN3ucv0Q7onCn/sSv6G p8TDA1pOSo3HrRl2opvCgdtIVW9QEpV8KdTL3i35AiNtSUYNzHIMIF5colw4+g1HzmOGuN AM//xJ/22pISFsG1oqwV0BMinbKUjHCdxiA710zWBgPkOymgKbfGL00J3QrF0znswor/Ve EPZxkTPhjXG8GHev4OW/4JEYjtJFKWtwjqYrTfwFG8jmJxwLPDAu83L4irZ2mQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640837218; a=rsa-sha256; cv=none; b=qSDWa96Aw6W7ZwZL3pwf5mgVnvWymnZExnIjiEuPOUP0Q4qUUknOBXVybcbhmtusMVZJq1 dymHjClJmI0Xi7ArxZL2ZlID/otopT35aCS5Z1QcJxGsPpSwOxNCPdBJiolKyPAe0oYfT8 53EPbCF14BIz3KSln2UrLEUBuGCbsJ+6gW7DSsdSBwX5k7nmN1F87LjJ36e373BviFpndf Jc7xB7cSVfpmLYCZYhutWppJAiMLtNBwiCOyw54FGdfbTq0wIgykMgOCIoGca5sfqaUVen fnmrpxNTXxLE8biKqF+U2MvvDH44is2bq+TETRNUWXTws6Ri1G4W/HNZqZIxUQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="KRvWr/Vm"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.17 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="KRvWr/Vm"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 583ED2EF2E X-Spam-Score: -3.17 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7spbOIV/+JDJ --000000000000adf0d405d4552c49 Content-Type: text/plain; charset="UTF-8" This patch fixes an issue in which captions for custom listing environments are not converted correctly. To illustrate the issue, take the following MWE. file.org: ``` #+caption: Perform inter-sample interpolation. #+begin_src python import numpy as np #+end_src ``` file.el: ``` ;; Loading straight isn't necessary if you don't use it, just need to ;; load org. (load "~/.config/emacs/straight/repos/straight.el/bootstrap.el") (straight-use-package 'org) (find-file "file.org") (setq org-latex-listings 'minted) (setq org-latex-custom-lang-environments '((python "\\begin{listing} \\begin{minted}[%o]{python} %s\\end{minted} \\caption{%c} \\label{%l} \\end{listing}"))) (org-latex-export-to-latex) ``` Run the example with: emacs -Q --batch -l file.el Before the patch, you get: ``` [...] \begin{listing} \begin{minted}[]{python} import numpy as np \end{minted} \caption{(((Perform inter-sample interpolation.)))} \label{nil} \end{listing} [...] ``` After the patch, you get: ``` [...] \begin{listing} \begin{minted}[]{python} import numpy as np \end{minted} \caption{Perform inter-sample interpolation.} \label{nil} \end{listing} [...] ``` I'm not actually 100% confident that the patch is the optimal way to do this. The API wasn't totally clear to me in this case. Any advice here is appreciated. Matt --000000000000adf0d405d4552c49 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-ox-latex.el-Fix-caption-format-for-custom-latex-src-.patch" Content-Disposition: attachment; filename="0001-ox-latex.el-Fix-caption-format-for-custom-latex-src-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kxsg22s90 RnJvbSA1YjA2MDFkNmQzYjgwMzQyMDJjNGI5YjgyMGM2NGE3MTllMzEyOWI5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXR0IEh1c3phZ2ggPGh1c3phZ2htYXR0QGdtYWlsLmNvbT4K RGF0ZTogV2VkLCAyOSBEZWMgMj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