News for hackers. Stuff that matters.
Re:Ferret: a Lisp implementation for real time embedded cont... by antt on Tuesday July 31, 2018 @10:24AM (#17653373)
There's singles of us!

If you want to extract it run M-x org-babel-tangle and you will end up with the usual source files and directories installed relative to the location of the org file.

I doubt there's a dozen people in the world that do it. But it is surprisingly useful and powerful when you get used to it. If anyone in Melbourne is interested in learning about this I have been toying with the idea of running a workshop on it.

I'm in the process of getting the detangle working for noweb mode. The current implementation fakes it with regex which force you to write code linearly instead of literately. But even if you can't detangle arbitrarily nested code it's magic to see changes in a source file appear in the right source code block.

Re:Ferret: a Lisp implementation for real time embedded cont... by DennisP on Tuesday July 31, 2018 @12:05PM (#17654375)
So you're doing literate programming with org-mode. That's pretty nifty.

I'm on the opposite side of the planet but I'd be interested, if you did an article or video on whatever you would teach in the workshop.

Re:Ferret: a Lisp implementation for real time embedded cont... by th0ma5 on Tuesday July 31, 2018 @12:27PM (#17654547)
I know the rather spiffy project http://thi.ng uses org mode for literate programming and web site generation all from the source code. It doesn't seem to be all one big file, but I think each component may be a file.
Re:Ferret: a Lisp implementation for real time embedded cont... by throwaway427 on Tuesday July 31, 2018 @03:27PM (#17656258)
Been doing emacs config in org for a long time. I think it's more common than you think, at least for that purpose.
Re:Ferret: a Lisp implementation for real time embedded cont... by antt on Tuesday July 31, 2018 @08:17PM (#17658529)
Quite possibly, outside of a post every two weeks or so on HN I have never met anyone else who uses it.

Though I have met a few people who use org mode as an organizer/planner.

Re:Ferret: a Lisp implementation for real time embedded cont... by Touche on Tuesday July 31, 2018 @11:16AM (#17653824)
How do you deal with having to scroll such a large file? That's the biggest turn-off to literate programming for me. I don't like code files more than a couple hundred lines of code. Search isn't enough for me.
Re:Ferret: a Lisp implementation for real time embedded cont... by Jtsummers on Tuesday July 31, 2018 @11:26AM (#17653933)
Org mode will let you collapse trees and source blocks. You can also narrow the view to a sub tree. This makes navigation much easier.
Re:Ferret: a Lisp implementation for real time embedded cont... by heavenlyblue on Tuesday July 31, 2018 @11:40AM (#17654113)
So how is navigating the file tree any different from navigating the source code tree?

Just don’t tell me “you can see the context” as any proper codebase would probably not be linear in code flow anyway.

Re:Ferret: a Lisp implementation for real time embedded cont... by Jtsummers on Tuesday July 31, 2018 @12:10PM (#17654416)
I mean, it isn't, if you organize your file identically to the source tree. But I break it out differently when I use this approach. I'll use the noweb references and scatter my code across the document in a logical way that's not reflective of the generated source tree.

For instance, I group all include or equivalent statements in an appendix, rather than within the primary code discussion. If a block of code can't be directly reused, but for some reason needs to be in every (or several) source files (think standard boilerplate), I'll write it once in a place that makes sense, and reference it from all the places where it actually gets tangled into the output.

Additionally, I include the Makefile (or whatever equivalent) and other scripts within this same document. Learning docker? Make a dockerfile in here, fully annotated, along with the shell commands to actually deploy it.

Mine will only mirror the original source tree if it's:

Very simple.

I've imported a bunch of code into it and don't, yet, know how to break it down.

An example C project may look like:

  * Purpose Statement
  * README
  * Usage
  This program can be executed from the command line by calling:
  #+BEGIN_EXAMPLE
    $ ./foo
  #+END_EXAMPLE
  It accepts the following command line parameters:
  - =-c= :: something
  - =-d= :: something else
  ** Implementation
  To process the command line flags we use <some library>.
  it has the following API calls...

  Here's the code for processing our commands...
  * Business Logic
  We communicate with the server via some REST API described in <location>
  and <library> to make the calls.
  -- Here I'd intermingle the REST API I'm using and the C API I'm producing
  -- for my own consumption, or something similar.
  * Code that's not fully organized yet
  ** Main Function
  This is the entry point, blah, blah, blah:
  #+BEGIN_SRC c :noweb yes :tangle src/main.c
  #+END_SRC
  * Appendix: Includes
Re:Ferret: a Lisp implementation for real time embedded cont... by jacobush on Tuesday July 31, 2018 @11:48AM (#17654214)
That it's not different is kind of a good point?

Some people use several Emacs windows (or frames or whatever) but all of them peeking into the same file, but in to different locations of it.

Re:Ferret: a Lisp implementation for real time embedded cont... by ehaliewicz2 on Tuesday July 31, 2018 @02:00PM (#17655436)
If it's all the same, why use separate files?
Re:Ferret: a Lisp implementation for real time embedded cont... by emidln on Tuesday July 31, 2018 @04:09PM (#17656634)
When your IDE (or Emacs in this case) offers go jumping/searching functionality, it doesn't really matter how many files your code is in. When I used bare vim, I cared a lot more about code organization than I do with an IDE that makes jumping around the codebase easy.