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 GADmH9QfeWL6YQEAbAwnHQ (envelope-from ) for ; Mon, 09 May 2022 16:06:12 +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 MH/lH9QfeWJoJgEA9RJhRA (envelope-from ) for ; Mon, 09 May 2022 16:06:12 +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 F2CC91E830 for ; Mon, 9 May 2022 16:06:11 +0200 (CEST) Received: from localhost ([::1]:47810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no41a-0007iq-Nf for larch@yhetil.org; Mon, 09 May 2022 10:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no3yO-000505-9r for emacs-orgmode@gnu.org; Mon, 09 May 2022 10:02:52 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:45667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no3yM-00077W-C4 for emacs-orgmode@gnu.org; Mon, 09 May 2022 10:02:52 -0400 Received: by mail-pf1-x42d.google.com with SMTP id y41so7493655pfw.12 for ; Mon, 09 May 2022 07:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:references:user-agent:in-reply-to :message-id:mime-version; bh=2naULAejGVAGyCIDr/WZ8zx9GzzQLmUGjxIXBdb1/q8=; b=c+dEVRGy5zQDwYuw5FG+Z3t+W3Z4sMhXwJirY38HCfD9LhyNt6Usd6O/fwgoFeMCtE Nqy3IN35nk3n7Atl0rqyRjB4JJfdjUEDdRS55iQRHpsl9geXoyeSEU2dqD4cMb/Keto0 ee+GsrN0ALMdplKv3nGFpUDdMOI9htZ8qEOrWgES9sXBH3lkRBjX0srmvW1/smnrUxlu Rw8qm4tu1jvSqxf9WGtPqbTqeM8Y0XnaqrU1tuEMU29LCPkT3MgVDEjTvk6wXFHNmpx/ XPnRwVhk96gcCLM/aaA30HjYPBSX4UYTxOOAF0hAoFE9hclacYanym+2U57wPZ88U8CE H8gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:references:user-agent :in-reply-to:message-id:mime-version; bh=2naULAejGVAGyCIDr/WZ8zx9GzzQLmUGjxIXBdb1/q8=; b=WJwJufDyJSqXOLl37Wes5Tt8KXY02SfsWWUSJbiKBl41je6nuzNO+xyfGzGHt6tBFg thAfvFELX3E92bx33Ms1UMipOk5n6EKFr5SIzxS2hT2F2Q1NgYlceV71Sbz9X4cVJne6 yZvDCpLv+l24+S6xU4nZ3QI6gmP9f5p2ylcHKBljUi7/0oHHF0ahJ9tJWfQ4Lo086P2/ PS+u61rTYFssmtttKv7DC8BdEys98bqf+QGRRsCs6emJRDmLY7TFB7bzWzcEQYFMy2wq Pq00USUVh26Vi/Wyv5UF0a2SZ2aYAnigD4vGXibYoDuF92o1sRIkIgZUyG8XJaxWkonz zGAg== X-Gm-Message-State: AOAM530AoGOWgWbI3j2EF1fOVGMaOiaH4RBG2J5HJrSAc/Iu1HlWMAxk lSY02OaxiMAyiiNqxdlv49w= X-Google-Smtp-Source: ABdhPJxwU5jJlh+kFHYC6D4HbEsn3n7A47dVltxHOi0Fw1HqX4ewgdHpuGGk8zJaADlt/5AGaz/A1w== X-Received: by 2002:a65:4007:0:b0:3c6:c6e2:1ccc with SMTP id f7-20020a654007000000b003c6c6e21cccmr3564212pgp.500.1652104968791; Mon, 09 May 2022 07:02:48 -0700 (PDT) Received: from localhost (61-245-128-160.3df580.per.nbn.aussiebb.net. [61.245.128.160]) by smtp.gmail.com with ESMTPSA id e6-20020a63e006000000b003c1ee2c4242sm8513522pgh.33.2022.05.09.07.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 07:02:48 -0700 (PDT) From: Timothy To: Ihor Radchenko Cc: Daniel Fleischer , emacs-orgmode@gnu.org, Nicolas Goaziou Subject: Re: [PATCH] (v2) New LaTeX code export option: engraved Date: Mon, 09 May 2022 20:57:12 +0800 References: <87wnf1z1w8.fsf@gmail.com> <87sfpogyag.fsf@localhost> <87v8ukyo94.fsf@gmail.com> <87sfpoyn0l.fsf@gmail.com> <875ymhzzvq.fsf@localhost> <87o809n7hw.fsf@gmail.com> <87mtftmxox.fsf@gmail.com> <87levcm2bx.fsf@gmail.com> <874k1zqlab.fsf@localhost> User-agent: mu4e 1.6.10; emacs 28.0.92 In-reply-to: <874k1zqlab.fsf@localhost> Message-ID: <87ee12n6re.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=tecosaur@gmail.com; helo=mail-pf1-x42d.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652105172; 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=2naULAejGVAGyCIDr/WZ8zx9GzzQLmUGjxIXBdb1/q8=; b=mmZm701gVc8s9DFOQWTt+ubUTMeXxerjd5cUc2uvhwOBc/gm2dP8nAaWs+CyIvz2aSDxoD dHZUXgXWQT8E4u3RcDHPxPozyjw9cPdfDwhyGKZKd7Wc1+xRhTPqnlOFsuTfl12ZaPw61s 9ougy2gC5uh/7JFk9wdL6KjtHWO1HFuaDEyYLPIX7E/LM49TxeGGuxdq35NiVv5J5rLL4i EAYfxzSCJrBiT7IcT/d3WrAkauA+rhSVunYSGXGtkfbtTrz3DApqaKYASEh+Rsfq37Tz8+ 9TFuDEwmCtFlUAa6PJhNYnmDry0Lu922750fO7vldlQs83ixRtQcY6+OpAZEXA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652105172; a=rsa-sha256; cv=none; b=Ql4/ixYIwTSaZ9WbQt0XYgXOwnvhU6kXqzEaog+THI7ouF7Oq8+miBW/Av9R+B4fOxJ5i0 9Upp10JTvGOu6DZUYBHkelTEWu5ROJtzN4ZlYam6Cetfmf+pWwN7ePMmSxDm1pa8I4rk29 qK458QU5aIsFviYJjTWhs2Bqa6rKsB3AG6eJxq0tcgbbHuCiILrTpNdjZGg9+lWRYowyOt skbSU5TWTZ7pUgxUDMxeSuW2Vp2etJquj9AlKRHCqZi6a8TX7uOTV8o6gRTXeAgF2JEDag CdWyc3f8tDlaTGsiRYaS/hyCOAjcHW7hqKAq5a1LItyYQMhklJ886aehLNZ4qQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=c+dEVRGy; 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: -6.50 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=c+dEVRGy; 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: F2CC91E830 X-Spam-Score: -6.50 X-Migadu-Scanner: scn0.migadu.com X-TUID: ZucwydOo7dPg --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ihor, > Before merging, could you also try to implement tests at least for > engraved feature? If I recall correctly, we do not currently have > backend-specific tests. But it would certainly help if we did. You might > as well write a small =E2=80=9Cnucleus=E2=80=9D test for ox-latex. Probably not a bad idea, I=E2=80=99m just not sure what/how I=E2=80=99d go = about this. > Also, unless I miss something, there is no support for coderefs in the > patchset. Is it intentional? I think you=E2=80=99ve missed something. It has the same coderefs support a= s minted. > It appears that the code for caption-str is duplicated. It could be > also factored out. It could, but I=E2=80=99m not sure this is actually a good idea as the dupl= ication is more the result of chance than a common dependency. >> + (format-spec custom-env >> + `((?s . ,formatted-src) >> + (?c . ,caption) >> + (?f . ,float) >> + (?l . ,(org-latex=E2=80=93label src-block info)) >> + (?o . ,(or (plist-get attributes :options) =E2=80= =9C=E2=80=9D))))))) > > I do not see a definition of `format-spec=E2=80=99 function. There is only > `spec=E2=80=99 above in the code. Can you double check? Either I am missi= ng > something or something fishy is going on. This code isn=E2=80=99t introduced by my patches, just relocated. FWIW `for= mat-spec' is provided by Emacs, and I don=E2=80=99t think is new. >> + (let ((code (org-element-property :value inline-src-block)) >> + (lang (org-element-property :language inline-src-block))) >> + (pcase (plist-get info :latex-listings) >> + (=E2=80=99nil (org-latex=E2=80=93text-markup code =E2=80=99code i= nfo)) >> + (=E2=80=99minted (org-latex-inline-src-block=E2=80=93minted info = code lang)) >> + (_ (org-latex-inline-src-block=E2=80=93listings info code lang)))= )) > > Please use `nil and `minted. Using =E2=80=99 may create issues in older = Emacs. Done. >> +% In case engrave-faces-latex-gen-preamble has not been run. >> +\ >> +\ > > What is the difference between EfD and EFD? EfD is also not documented. Documentation added. EfD is the background colour. >> +FVEXTRA-SETUP sets fvextra=E2=80=99s defaults according to >> +`org-latex-engraved-options=E2=80=99, and LISTINGS-SETUP creates the >> +listings environment and defines \.=E2=80=9C > > It is unclear what listings environment does given that we use engraved > package. Can you provide a bit more details in the docstring on what the > user will get if [LISTINGS-SETUP] is present. > It may catch users by surprise that deleting this will make captions > disappear. It does the same thing as minted=E2=80=99s `listings' environment, hence th= e choice of name. Documentation added. > Why not just > (org-element-map (plist-get info :parse-tree) > =E2=80=99(src-block inline-src-block example-bloc= k fixed-width) #=E2=80=99identity > info t) Ah, in my config I=E2=80=99m also using some engraved info for example/fixe= d-width blocks. I=E2=80=99ll leave this out for now. >> (pcase (plist-get info :latex-listings) >> (=E2=80=99nil (org-latex=E2=80=93text-markup code =E2=80=99code i= nfo)) >> =E2=80=A6 > Same comment about ` in pcase. Done. > What will happen if there is no [LISTINGS-SETUP]? Captioned/Floating code blocks won=E2=80=99t work. >> +(defcustom org-latex-engraved-theme nil > Docstring does not explain what happens when set to nil. > Also, does :type =E2=80=99symbol allow t and nil? I think so, `symbolp' says they=E2=80=99re symbols if nothing else. > Will it work when engraved-theme is t? Yes. > What about example-block and fixed-width? I may be missing something, > but earlier in the patchset you had conditionals of the type > (or src-p fixedw-p). So, does engrave-faces do anything with fixedw-type > elements? Resolved earlier. >> + (gen-theme-spec >> + (lambda (theme) =E2=80=A6 > > This appears to be not guarded by (require =E2=80=99engrave-faces-latex n= il t). It is before it=E2=80=99s actually called. >> -(defun org-latex-src=E2=80=93engrave-code (content lang) >> - =E2=80=9CEngrave CONTENT to LaTeX in a LANG-mode buffer, and give the= result.=E2=80=9D >> +(defun org-latex-src=E2=80=93engrave-code (content lang &optional theme= options inline) >> + =E2=80=9CEngrave CONTENT to LaTeX in a LANG-mode buffer, and give the= result. >> +When THEME is non-nil, it will be used.=E2=80=9D > > You did not document the remaining two arguments. (this makes me ask a > question whether you checked compile warnings). Also, consider running > M-x checkdoc on ox-latex.el. Now documented. I have checked compile warnings (there are none), but checkdoc is currently= a bit dodgy on the Emacs commit I=E2=80=99m on. >> - (insert content) >> + (insert (string-trim-right content =E2=80=9C=E2=80=9D)) > > As a theoretical possibility, what will happen if content has something > like =E2=80=9C%=E2=80=9D? Discussed in DMs. It just gets rid of trailing newlines, and it=E2=80=99s f= ine with escaping. All the best, Timothy --=-=-=--