No problem! I have some more coming up :-) I've been looking at getting org-babel to add line directives for languages that support it. (c, c++, haskell...). It would make literate programming for these kinds of languages much better, and other people have been complaining e.g. https://paulbatchelor.github.io/blog/posts/2018-09-21-org-babel-impressions.html
Unfortunately there is no easy way to hook this into org-babel now without doing some rather intrusive work. 1) The language specific expansions don't know the file or the line a block comes from, and noweb references have already been expanded. 2) The tangle-body-hook is useless since it runs in a temp buffer that doesn't even have the major mode set for the language you're tangling to. 3) The :comments mechanism is not strong enough to allow language specific comments and it 's different for noweb vs. normal block expansion. Would there be interest in such a feature, if it doesn't change current behaviour? Immanuel On Fri, Aug 30, 2019 at 11:37 PM Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: > > Hello, > > immanuel <immanuel.litzr...@gmail.com> writes: > > > #+NAME: this is a test > > #+BEGIN_SRC elisp :tangle no > > > > (message \"aha\") #+END_SRC > > > > #+BEGIN_SRC elisp :noweb yes :comments noweb :tangle out.el > > first > > <<this is a test>> > > second > > #+END_SRC > > > > #+BEGIN_SRC elisp :tangle no > > (progn > > (org-babel-tangle) > > (with-temp-buffer > > (insert-file-contents "out.el") > > (buffer-string))))) > > #+END_SRC > > > > > > Doesn't work. The reason is that the function > > org-babel-expand-noweb-references uses > > > > #+BEGIN_SRC emacs-lisp > > (c-wrap (lambda (text) > > (with-temp-buffer > > (funcall (intern (concat lang "-mode"))) > > ... > > #+END_SRC > > Fixed! Thank you for the report and the analysis. > > Regards, > > -- > Nicolas Goaziou