emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments
Date: Tue, 31 May 2022 06:48:11 +0000	[thread overview]
Message-ID: <7702b511-c289-5688-c64c-fb673324a63a@posteo.eu> (raw)
In-Reply-To: <87y1yiz3js.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]


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

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

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

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

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.


Sébastien Miquel

[-- Attachment #2: Type: text/html, Size: 4015 bytes --]

  reply	other threads:[~2022-05-31  6:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15 10:42 [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments Sébastien Miquel
2022-04-28 13:45 ` Ihor Radchenko
2022-04-29 14:27   ` Sébastien Miquel
2022-04-30  6:05     ` Ihor Radchenko
2022-04-30  7:35       ` Sébastien Miquel
2022-04-30  8:41         ` Ihor Radchenko
2022-05-30 19:51       ` Sébastien Miquel
2022-05-31  5:14         ` Ihor Radchenko
2022-05-31  6:48           ` Sébastien Miquel [this message]
2022-07-16  8:57             ` [FR] Make :var foo=name-of-src-block assign the source block code instead of currently assigned result of evaluation (was: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments) Ihor Radchenko
2022-07-16 10:17               ` Greg Minshall
2022-07-16 10:45                 ` Ihor Radchenko
2022-07-16 14:31                   ` Greg Minshall
2022-07-17 17:39                   ` Sébastien Miquel
2022-07-23  4:52                     ` Ihor Radchenko
2022-08-29 17:39                       ` [PATCH] " Sébastien Miquel
2022-08-31  4:04                         ` Ihor Radchenko
2022-07-21 11:13             ` [PATCH] org-babel: Do not echo output of resolved noweb references Ihor Radchenko
2022-07-21 13:41               ` Sébastien Miquel
2022-08-22 12:01               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7702b511-c289-5688-c64c-fb673324a63a@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).