From: Arthur Miller <arthur.miller@live.com>
To: Bob Heffernan <bob.heffernan@gmail.com>
Cc: Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Org mode & "literate programming": including files
Date: Wed, 07 Apr 2021 18:47:03 +0200 [thread overview]
Message-ID: <AM9PR09MB497783EF1886838DBD0C1C4296759@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <20210407082833.xtrxpwyczgghxb7l@bob-nuc> (Bob Heffernan's message of "Wed, 7 Apr 2021 09:28:33 +0100")
Bob Heffernan <bob.heffernan@gmail.com> writes:
> On 21-04-07 05:54, Arthur Miller wrote:
>> I saw your question on reddit, and I saw somebody already posted you an
>> answer. You are looking for `org-babel-lob-ingest`.
>>
>> Check the SX link posted to you on Reddit, it has what you are asking for:
>>
>> https://emacs.stackexchange.com/questions/31999/config-examples-and-use-cases-of-library-of-babel
>
> Arthur,
>
> From what I understand, the library of babel is a feature to glob
> regularly used (named) code blocks into a single file, for use in
> other org files. While this looks as if it could be used to achieve
> what I want (first, ingest some code into the library, then use it
> elsewhere) I was hoping for something similar to the sort of thing
> that is present in most programming language REPLs: load whatever
> source file you want, then use the procedures therein.
I found the org-babel to be much better option since it will save you
exporting (tangle) and evaluate org files everytime you load them. It is
more efficient. It also let's you use named blocks, so you potentially
don't need to load everything, just what you need.
If you really wish to do this in style oc #include <someheader.h>,
look at the org-babel-load-file. It will do what you ask, but it is
slow. It will export your .org file (tangle it) to .el and then load the
produced lisp file. As a note, you can look up any elisp function in
Emacs with C-h f RET function-name. Now imagine doing that for many
files. The applications will load quite slow if they include many files
and load them that way.
Somebody above already posted you an answer that you
are rather supposed to export your org files to el, and import those el
files. So it is probably better to either export your code to .el files
and byte/native compile them and use orinary `require' or `load' or use
`library-of-babel'.
I am not an expert, but that is how I understand it to be in Emacs. I am
sure if I am wrong someone here will correct me :-).
>> Hope it works for you and don't forgett to say thanks to the guy on Reddit.
>
> I'll take a closer look at it and thanks for your help.
> (& you're right, I need to go back to reddit and respond!)
> Regards,
> Bob
Best regards
/a
prev parent reply other threads:[~2021-04-07 16:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 18:38 Org mode & "literate programming": including files Bob Heffernan
2021-04-06 20:18 ` Nikolay Kudryavtsev
2021-04-06 21:59 ` Bob Heffernan
2021-04-07 3:54 ` Arthur Miller
2021-04-07 8:28 ` Bob Heffernan
2021-04-07 16:47 ` Arthur Miller [this message]
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM9PR09MB497783EF1886838DBD0C1C4296759@AM9PR09MB4977.eurprd09.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=bob.heffernan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).