From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: interaction between org-latex-custom-lang-environments and name when exporting to latex Date: Mon, 23 Nov 2015 12:13:06 +0100 Message-ID: References: <877fld3qcr.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0p3W-0000MY-6e for emacs-orgmode@gnu.org; Mon, 23 Nov 2015 06:13:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0p3S-0004aF-Vx for emacs-orgmode@gnu.org; Mon, 23 Nov 2015 06:13:10 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:10265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0p3S-0004Zz-R1 for emacs-orgmode@gnu.org; Mon, 23 Nov 2015 06:13:06 -0500 In-Reply-To: <877fld3qcr.fsf@gmx.us> (rasmus@gmx.us's message of "Fri, 20 Nov 2015 11:41:24 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, On 2015-11-20 11:41, Rasmus writes: > Alan Schmitt writes: > >> I was wondering if someone had been able to reproduce this, and if so >> should I file it as a bug? > > Sure. It's how org-latex-src-block handles custom environments (see "Case > 2."). At the moment this is hardcoded. I've started to look into this, and I would like some advice regarding the design of the solution. What I propose is to have either a string or a function in `org-latex-custom-lang-environments'. A string would be used as it is currently, whereas a function would be applied. Here is what it could look like: #+begin_src emacs-lisp ;; Case 2. Custom environment. (custom-env (let ((caption-str (org-latex--caption/label-string src-block info)) (formatted-src (org-export-format-code-default src-block info))) (cond ((stringp custom-env) (format "\\begin{%s}\n%s\\end{%s}\n" custom-env (concat (and caption-above-p caption-str) formatted-src (and (not caption-above-p) captio= n-str)) custom-env)) ((functionp custom-env) (funcall custom-env formatted-src (org-latex--label src-block info))) (t (user-error "`org-latex-custom-lang-environments' should map %s to e= ither a string or a function" lang))))) #+end_src My main design question is what the arguments to the function should be. I thought the formatted source code and label would work, but I'm wondering if it may be better to simply give the `src-block' and `info' arguments directly. WDYT? Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Athmospheric CO=E2=82=82 (Updated November 22, 2015, Mauna Loa Obs.): 400.3= 5 ppm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJWUvTCAAoJEAQNCjtO0uXHT4gH/RQJWRjBvrZb81Ryu0bCUX4C YKPTRlhFrD5fGVWz4YsKxijy5EVFUQ6dVUfA4JTpPdzbgT+Xnz9scqieKxtAKomf xqZJXmUpFwdHWDOGFYYyk7Jx2GFgtIVr5pmZpzDTPgXQA5CddkK8YwIj0iM21vyi bsdUzJbSxFl9FWw0IkOaxIN3dFY3uFkOcrRIQBBypr1p1m1Dtvgc+tknaFB+FRct lmKsYt6Jd+ZEbUXI6vNif6EXFPaAHjfFTtI5bwv95EEN28gic5mC56RyGRMO9FRj 6YhsVD35KXxCfMtUaYdHRUUG4ZHFfcyX4kq+F+mAfxOJrr4KV6raUsoaaVGeRZw= =oovN -----END PGP SIGNATURE----- --=-=-=--