emacs-orgmode
[Top][All Lists]
Advanced

[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: Mon, 30 May 2022 19:51:56 +0000

Hi,

Ihor Radchenko writes:
Thinking about the whole idea of :noweb-trans more, I see little benefit
compared to something like:

#+name: documentation
This is a sample function documentation.
Because there are "quotes", it must be escaped and cannot be directly
used as noweb-reference.

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

#+begin_src emacs-lisp :tangle yes
(defun test ()
<<doc-escape(str=documentation)>>
t)
#+end_src
I had converted my uses (tangling code, not text/documentation) to
this but I ended up reverting.

Some drawbacks:
 + doesn't work for all languages (does work for LaTeX)
 + 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.
 + src block execution also resets the noweb cache, slowing down
   tangle, though I have not tried to measure the effect.

As stated in the OP, I find it unfortunate that org does not provide
any way to tangle the content of a src block to a string representing
this code. If anyone shows any interest, I've provided two possible
implementations in this thread, that I can rebase.

Regards,

--
Sébastien Miquel




reply via email to

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