5 ms·
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
by antt 8y ago
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.
- Touche 8y agoHow 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.
- Jtsummers 8y agoOrg mode will let you collapse trees and source blocks. You can also narrow the view to a sub tree. This makes navigation much easier.
- heavenlyblue 8y agoSo 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.
- jacobush 8y agoThat 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.
- Jtsummers 8y agoI 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
- ehaliewicz2 8y agoIf it's all the same, why use separate files?
- emidln 8y agoWhen 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.
- DennisP 8y agoSo 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.
- th0ma5 8y agoI know the rather spiffy project http://thi.ng 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.
- throwaway427 8y agoBeen doing emacs config in org for a long time. I think it's more common than you think, at least for that purpose.
- antt 8y agoQuite 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.