From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yDD/G6tgTmMXdAAAbAwnHQ (envelope-from ) for ; Tue, 18 Oct 2022 10:15:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eE8DHKtgTmO95gAA9RJhRA (envelope-from ) for ; Tue, 18 Oct 2022 10:15:39 +0200 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 2E14825F73 for ; Tue, 18 Oct 2022 10:15:39 +0200 (CEST) Received: from localhost ([::1]:37220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okhlB-0005I9-Lv for larch@yhetil.org; Tue, 18 Oct 2022 04:15:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okhh2-0005HC-K7 for emacs-orgmode@gnu.org; Tue, 18 Oct 2022 04:11:20 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okhgt-0008Fs-6E for emacs-orgmode@gnu.org; Tue, 18 Oct 2022 04:11:19 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C1C8E240026 for ; Tue, 18 Oct 2022 10:11:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666080668; bh=wVm6X4gIb4cFU1TvHoBrXC5wZ9bIAAYupl/oj1nE+aw=; h=From:To:Cc:Subject:Date:From; b=Nknk5cEKa4m7y9FlRO5poGYfZw4h0obvpuLlHjpaJZalg/DT0YAnD209oMdIZtsfA KUPAZo0enKrjcfc5PCU8MjDSq7jYDCsKffrvqIliHcAP9M3tE2bmE8G3iGAbsMLWdd zCoaTdYJ2ECQMzKdg6/StiKmMGx80wFHnulWzxzpkg6nRlctlJSWtP3mLVixid3KQH GYY35/jNXRs8fDcRZxXNlKuFCPxdODhE4ICmLLivQJx5Tj7cWtHbK/8/St1bkU4vf2 08CutiCF5pIkYtuIH+IbkCO10D1jH8+FFDl4pIgvomMVNM7/Og//fqZnGZ5SdrRTjp pjy66vjT7Rlug== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ms64m1sgNz6tmS; Tue, 18 Oct 2022 10:11:03 +0200 (CEST) From: Ihor Radchenko To: Denis =?utf-8?Q?Bitouz=C3=A9?= Cc: Daniel Fleischer , emacs-orgmode@gnu.org Subject: Re: Option that prevents Org to add =?utf-8?Q?=5Clstset{language=3D=E2=9F=A8language=E2=9F=A9=2C=2E=2E=2E}?= when code blocks are exported to LaTeX In-Reply-To: <87pmepvb7u.fsf@example.com> References: <87zgmda67z.fsf@example.com> <87mt9thioz.fsf@localhost> <87pmepvb7u.fsf@example.com> Date: Tue, 18 Oct 2022 08:11:50 +0000 Message-ID: <87y1tdeek9.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de 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, 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.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=1666080939; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=r1EJy6zAoGaz36p9Ka4ObjK3sByO0keZvMv8qQG16is=; b=mQfFN/x6unW8sHFIG+LjZOxi2punQOq+PzbUeLCsRlPdhWf2YkQ4CpZbCl6MFbbaVTLRSX DnsG7lVGS89KEeyw1ah2Wdp6ca9oRt9OYkZPjtLSRdngKOTG8/9yDpb8TB3fdW9v4QmEWh NjyENe8Q0GWdHU/YuQEUJekRQ5JyVjc6ftTsvuSZk8FkXTl/bbeWElOiZqwRF3pg0zfD+d EVY/gWSfhtTdLsCDz7BmRyp1vHi3s5nmw3Mhxr9oCJwByaYGsarO5hn+fzXrCl8/T0aNuv TelScyMxXwLo6DuMxNaxfv4xrq/BXexb83xgkUPKE0Nb2Y9QpyoRNqEXt1gOoA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666080939; a=rsa-sha256; cv=none; b=bjGHQcPSL1ScDX0vD8yCcUjtuJQc35A0HV+fdth+fAYMpXIikO16zeKWVfkAvXC5NQkWsa UqbOLmWuaDHKSB7hVYf7TWhC4BCQ5KLfrz3Y5+rnMPG/8wszC1khJR3XXMgRPubrB3EinB 6YvUGwGhVm8FYQrZ1LZ7miUDNjTiIFWUU+f23a3QIpXTd6ciOSGkZM2iIe/bTy9aNwV3AC AU1goN6m3maZ3D28B/iH0GKZ2BDl+Z+VAkfF91eCAoc1dAPhMYZ0PeSZid6P1DuI7d7Osu 6IqHcOyqMXCo3rJqcjm87+oOZKus+eMC1u90DEylwUE6PRpy7ACzeL1Ll57Afg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Nknk5cEK; dmarc=pass (policy=none) header.from=posteo.net; 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: -8.92 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Nknk5cEK; dmarc=pass (policy=none) header.from=posteo.net; 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: 2E14825F73 X-Spam-Score: -8.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2OK61KflJ+1f --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Denis Bitouz=C3=A9 writes: > Otherwise, all the options specified by `\lstset` can be applied as an > option of the `lstlisting` environment: > > =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > =E2=94=82 \begin{lstlisting}[language=3D=E2=9F=A8language=E2=9F=A9,...] > =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 This should be the safest and the least verbose. I implemented the suggestion in the attached patch. Let me know if it works for you. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-org-latex-src-block-listings-Put-options-within-lstl.patch Content-Transfer-Encoding: quoted-printable >From f1905d7e854c8a1788f92326b453ebd1e2b4a21b Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Tue, 18 Oct 2022 16:09:19 +0800 Subject: [PATCH] org-latex-src-block--listings: Put options within lstlisti= ng environment MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/ox-latex.el (org-latex-src-block--listings): Do not use global \lstset to set options. Prefer optional argument to lstlisting environment instead. Reported-by: Denis Bitouz=C3=A9 Link: https://orgmode.org/list/87pmepvb7u.fsf@example.com --- lisp/ox-latex.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index dc8477d14..38bdbf661 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -3577,9 +3577,9 @@ (cl-defun org-latex-src-block--listings (org-export-data main info)))))) (lst-opt (plist-get info :latex-listings-options))) (concat - ;; Options. (format - "\\lstset{%s}\n" + "\\begin{lstlisting}[%s]\n%s\\end{lstlisting}" + ;; Options. (concat (org-latex--make-option-string (append @@ -3600,10 +3600,8 @@ (cl-defun org-latex-src-block--listings (t `(("firstnumber" ,(number-to-string (1+ num-start))) ("numbers" "left")))))) (let ((local-options (plist-get attributes :options))) - (and local-options (concat "," local-options))))) - ;; Source code. - (format - "\\begin{lstlisting}\n%s\\end{lstlisting}" + (and local-options (concat "," local-options)))) + ;; Source code. (let* ((code-info (org-export-unravel-code src-block)) (max-width (apply 'max --=20 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--