emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug: tangling with elisp as lang in a noweb reference doesn't wo


From: Immanuel Litzroth
Subject: Re: [O] Bug: tangling with elisp as lang in a noweb reference doesn't work [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/local/share/emacs/26.2/lisp/org/)]
Date: Sat, 31 Aug 2019 10:34:20 +0200

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 <address@hidden> wrote:
>
> Hello,
>
> immanuel <address@hidden> 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



reply via email to

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