emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Immanuel Litzroth <immanuel.litzroth@gmail.com>
To: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
Cc: TRS-80 <trs-80@isnotmyreal.name>, emacs-orgmode@gnu.org
Subject: Re: best practices query: non-emacs packages based on tangled source
Date: Wed, 28 Oct 2020 09:29:57 +0100	[thread overview]
Message-ID: <CAM1nAcxciZEN8bwyx94kfwfwtgexTYHO9dO0upHzk9yMGwXwkw@mail.gmail.com> (raw)
In-Reply-To: <87mu079ucj.fsf@web.de>

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)
#+ END_SRC


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

hey

#+HEADER: :tangle ex1.cpp
#+ BEGIN_SRC cpp :prologue "hello" :epilogue "goodbye"
main()
{}
#+ END_SRC

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

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.
Immanuel

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	other threads:[~2020-10-28  8:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 18:11 best practices query: non-emacs packages based on tangled source Greg Minshall
2020-10-15 21:22 ` Tim Cross
2020-10-16  9:09 ` Eric S Fraga
2020-10-16 14:52 ` Diego Zamboni
2020-10-16 15:04 ` TEC
2020-10-18  6:01   ` Tom Gillespie
2020-10-27 17:38     ` Greg Minshall
2020-10-27 18:09 ` TRS-80
2020-10-27 22:28   ` Dr. Arne Babenhauserheide
2020-10-28  8:29     ` Immanuel Litzroth [this message]
2020-10-28 13:25       ` Greg Minshall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM1nAcxciZEN8bwyx94kfwfwtgexTYHO9dO0upHzk9yMGwXwkw@mail.gmail.com \
    --to=immanuel.litzroth@gmail.com \
    --cc=arne_bab@web.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=trs-80@isnotmyreal.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).