From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kHGAFAS8lWJYuQAAbAwnHQ (envelope-from ) for ; Tue, 31 May 2022 08:56:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IJZ2FAS8lWL4LAEA9RJhRA (envelope-from ) for ; Tue, 31 May 2022 08:56:04 +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 DF7523963 for ; Tue, 31 May 2022 08:56:03 +0200 (CEST) Received: from localhost ([::1]:38052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvvnO-0004oQ-Q8 for larch@yhetil.org; Tue, 31 May 2022 02:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvvfv-0001iw-R7 for emacs-orgmode@gnu.org; Tue, 31 May 2022 02:48:20 -0400 Received: from mout02.posteo.de ([185.67.36.66]:57793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvvfq-00005j-Ua for emacs-orgmode@gnu.org; Tue, 31 May 2022 02:48:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 84CEC240109 for ; Tue, 31 May 2022 08:48:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1653979692; bh=PftD3rJyxcO4eSc77EujMHdOlbllEH4t4bYmCIoHO9o=; h=Date:Subject:To:Cc:From:From; b=pZCqOvix9SWKlbhAZA4BJ9C976iHv0FVFAXpso+MUGyGJkSY0cloj9c4Oy0r24Onw b1zQ/h2jVX8fj6Ku5u+tkxUYIwQIuzgAm01ULWNQvzNmUH3YJn80bwbiWw83FZKGNK TSioUFTmQK88U5Nmu8M7uyDdy2AjRslw9sf40FK87QqMf1uM7r2W1qmu1Ll1xH84Mk +svnF5uo9TWS8e6GNAW2Or/43cJe7qe0limvr6Eh4f18iqT3+7ktIRrFwhZUy0qeeU wxU2aDVnD+nx7pTPFHZVmT21YQdnhrY2hDUvg+6c3sJVZe3MRczHZzWq/mvKyitiVT g+/e5BqDY4svw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LC2sl4gSLz9rxS; Tue, 31 May 2022 08:48:11 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------ROI44gREjU6IfAEs6nQVsQTX" Message-ID: <7702b511-c289-5688-c64c-fb673324a63a@posteo.eu> Date: Tue, 31 May 2022 06:48:11 +0000 MIME-Version: 1.0 Subject: Re: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments Content-Language: fr To: Ihor Radchenko Cc: emacs-orgmode References: <2dd9630a-c584-0702-62aa-393ad56c621e@posteo.eu> <875ymt8goc.fsf@localhost> <87v8urt8bu.fsf@localhost> <03eb4c66-ecaf-b5f5-c4cc-2195fb6c1a1a@posteo.eu> <87y1yiz3js.fsf@localhost> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= In-Reply-To: <87y1yiz3js.fsf@localhost> Received-SPF: pass client-ip=185.67.36.66; envelope-from=sebastien.miquel@posteo.eu; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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: , Reply-To: sebastien.miquel@posteo.eu 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=1653980164; h=from:from:sender:sender:reply-to: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=xmZYzxYOL2Eev09YmnSkAbZwXeF1+X9R6QT2HIFOTaw=; b=Ei4/r8+lH8iQunL2/6wG98h/tDRz3uli66RnoPIO50vZdNb3K4rpt7kCxT7GdnAxwue5K7 29U97gxM/JZeNg3QfMA16I11/1tYz7WUEVlzA9LjLkbeLnx7w2FKQYnPGCjk6kOWJZ9ZUx 8p7RRgniGvwv5WgLQd8AckFodVg7Nf7G3NEGRhIVpYq6JFFNVvE4C3PFD8WPCl+K6T0fb+ bzq1N2Qh/zzYk0/LMwaeHZL16jbyCGy1amru04/d24auQgzz+M8W5ZKCPShEh4fiUXsPDY Ge60XVD8wFoebjNpFIPDleQWRBANxdSYKmdwM4M4f+H2mwpL47xhdxppIGnGiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653980164; a=rsa-sha256; cv=none; b=Oj6o2mB1hxlYWrcTDX/Tyi5Bxu6l7NN6M27ceAzUfTrh7Fp63O1dhwr9ZBKmi224sH5i/u jV4znetarqaN2TZz6u4bvfsVmttQzDRKmsu1FoODF6NF51fUBkGN3WMMjbySHgVTU6hI6X Vrs+OmaEficHMZeWfx7tH4WekY3WqOsyiql/WwL/C+9qG+g4sW82Wyyh1aiQe35haY6U/A E3vF/QEp22alDDcExkckejzUmMZCjuhEyk0UBDIvuw2uX0NHNkJ/CcyEdDltpwJfFtRNl7 3EuRVjUQwocoDcLj4Re7cwO+dOpsBap3fNB61mrrsSk3Nurx505YxK1yDo8ybA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=pZCqOvix; dmarc=pass (policy=none) header.from=posteo.eu; 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: -4.24 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=pZCqOvix; dmarc=pass (policy=none) header.from=posteo.eu; 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: DF7523963 X-Spam-Score: -4.24 X-Migadu-Scanner: scn1.migadu.com X-TUID: 600RwdUYJRHE This is a multi-part message in MIME format. --------------ROI44gREjU6IfAEs6nQVsQTX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Ihor Radchenko writes: > Can you provide more concrete examples? > >> Some drawbacks: >>  + doesn't work for all languages (does work for LaTeX) > Which languages do not work? Most languages do not work. Using your proposed solution, what I'm trying to do is #+name:javascript-header #+begin_src javascript :tangle no some javascript, with \ and " to be escaped #+end_src #+name: string-escape #+begin_src emacs-lisp :var str="" :tangle no (prin1-to-string (string-trim-right str)) #+end_src #+begin_src emacs-lisp :noweb yes :tangle yes (setq javascript-header <>) #+end_src If you replace javascript with latex, it happens to work, because when org executes a latex block, it prints its content. The goal is to tangle to some lisp code whose purpose is to generate LaTeX/javascript code. Quite niche admittedly, though as you showed, it could also be used to string-escape documentation. >>  + the tangle gets very noisy: not only are the result of execution >>    printed in the echo buffer, but emacs visits the tangling buffer >>    and moves the point to each block. >>    Perhaps this is a bug that can be fixed. > Did you try to play with :results header argument to disable messages? > What exactly went unexpected? I did. I might have missed something, but no combination of :results argument to both the latex block and the string-escape block silences the tangle (except for :results none, which doesn't tangle the content of the block). During tangle, the contents of the latex block are displayed (shortly) in the echo buffer (check *Messages*), and the point very briefly moves to the latex block. This isn't very noticeable with a single block. >>  + src block execution also resets the noweb cache, slowing down >>    tangle, though I have not tried to measure the effect. > I am not sure what you are referring to here. Can you elaborate? Lines 2892-2893 of (my) ob-core.el, in org-babel-expand-noweb-references: >              ;; Evaluation can potentially modify the buffer >              ;; and invalidate the cache: reset it. Regards, -- Sébastien Miquel --------------ROI44gREjU6IfAEs6nQVsQTX Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hi,

Ihor Radchenko writes:
Can you provide more concrete examples?

Some drawbacks:
  + doesn't work for all languages (does work for LaTeX)
Which languages do not work?
Most languages do not work. Using your proposed solution, what I'm
trying to do is

#+name:javascript-header
#+begin_src javascript :tangle no
some javascript, with \ and " to be escaped
#+end_src

#+name: string-escape
#+begin_src emacs-lisp :var str="" :tangle no
(prin1-to-string (string-trim-right str))
#+end_src

#+begin_src emacs-lisp :noweb yes :tangle yes
(setq javascript-header <<string-escape(str=javascript-header)>>)
#+end_src

If you replace javascript with latex, it happens to work, because when
org executes a latex block, it prints its content.

The goal is to tangle to some lisp code whose purpose is to generate
LaTeX/javascript code. Quite niche admittedly, though as you showed,
it could also be used to string-escape documentation.

  + the tangle gets very noisy: not only are the result of execution
    printed in the echo buffer, but emacs visits the tangling buffer
    and moves the point to each block.
    Perhaps this is a bug that can be fixed.
Did you try to play with :results header argument to disable messages?
What exactly went unexpected?

I did. I might have missed something, but no combination of :results
argument to both the latex block and the string-escape block silences
the tangle (except for :results none, which doesn't tangle the content
of the block). During tangle, the contents of the latex block are
displayed (shortly) in the echo buffer (check *Messages*), and the
point very briefly moves to the latex block. This isn't very
noticeable with a single block.

  + src block execution also resets the noweb cache, slowing down
    tangle, though I have not tried to measure the effect.
I am not sure what you are referring to here. Can you elaborate?

Lines 2892-2893 of (my) ob-core.el, in org-babel-expand-noweb-references:

             ;; Evaluation can potentially modify the buffer
             ;; and invalidate the cache: reset it.

Regards,

-- 
Sébastien Miquel
--------------ROI44gREjU6IfAEs6nQVsQTX--