[Top][All Lists]

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

Re: best practices query: non-emacs packages based on tangled source

From: Immanuel Litzroth
Subject: Re: best practices query: non-emacs packages based on tangled source
Date: Wed, 28 Oct 2020 09:29:57 +0100

I think the org way of tangling just doesn't work well for compiled languages.
Here are some reasons:
- Not possible to tangle all code going to a specified file
- Not possible to add line directives without major surgery
- Not all language modes do the correct thing
- No way to prevent overwriting an unchanged file
- Special casing e.g. Don’t tangle to a file called ‘no’.
Specific gripe:
- :prologue and :epilogue are not honoured by all modes
#+ BEGIN_SRC emacs-lisp :prologue "hello" :epilogue "goodbye" :tangle ex1.el
(+ 1 2)

#+ BEGIN_SRC haskell :tangle ex1.hs :prologue "hello" :epilogue "goodbye"


#+HEADER: :tangle ex1.cpp
#+ BEGIN_SRC cpp :prologue "hello" :epilogue "goodbye"

#+ BEGIN_SRC bash :tangle ex1.bash :prologue "hello" :epilogue "goodbye"

Based on the org machinery I've written a simple tangler which addresses some
of these shortcomings. It can add line directives to recursively expanded noweb
references -- and get that right. It can also take any action at the
end of tangling
like comparing your tangled file to the one on disk and not overwrite
if it's the same,
or just sending your tangled buffer to an interpreter not writing it
to file (remember that
error references point back to the .org file). Also it can tangle all
blocks going to the
same file. This has been tested for Haskell, C++ and elisp.
It's in a private repo on github because it's not ready for release
yet, but if someone
is interested I can give them access.

On Tue, Oct 27, 2020 at 11:30 PM Dr. Arne Babenhauserheide
<arne_bab@web.de> wrote:
> TRS-80 <trs-80@isnotmyreal.name> writes:
> > Therefore, any stuff I plan on releasing publicly, I do not do in
> > literate style (JMHO).  However if you are dead set on doing literate
> > paradigm, then maybe my experience is invalid for your use-case.
> My experience is that literate style works very well for tutorials, but
> whenever I developed a larger program within org-mode, I tangled it once
> I had to start debugging and then kept it as separate source.
> Once the code becomes complex, I want to stay in one programming
> language without outside features that also add extra complexity.
> That said, for simple code the additional freedom of multi-language
> programming in org-mode is awesome. I’m using that to create random
> roleplaying characters directly from random tables in org-mode, with
> those tables being the primary source (because the book is the most
> important product, not the code).
> Best wishes,
> Arne
> --
> Unpolitisch sein
> heißt politisch sein
> ohne es zu merken

-- Researching the dual problem of finding the function that has a
given point as fixpoint.

reply via email to

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