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