[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments

From: Sébastien Miquel
Subject: Re: [PATCH] Add :noweb-prefix and :noweb-trans babel header arguments
Date: Tue, 31 May 2022 06:48:11 +0000


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]