emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] tangle versus org-babel-load-file


From: Nick Dokos
Subject: Re: [O] tangle versus org-babel-load-file
Date: Tue, 03 Apr 2018 12:16:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Lawrence Bottorff <address@hidden> writes:

> I'm experimenting with Uncle Dave's config which is using a minimum init.el 
> to launch config.org, which
> is full of elisp babel source blocks. Here's his relevant launching code:
>
> (when (file-readable-p "~/.emacs.d/config.org")
>   (org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
>
> However, I've seen this example:
>
> (require 'org)
> (require 'ob-tangle)
> (org-babel-load-file (expand-file-name "~/.emacs.d/myemacs.org"))
>
> which seems to want (require 'ob-tangle). The Uncle Dave setup is working 
> fine. I guess I don't know how
> it's tangling (which means running all the code blocks in the org file, 
> right?) without somehow being
> told to. But then what is org-babel-tangle-file doing other than running all 
> the code blocks in a file?
> And then there's the :tangle yes parameter on an individual code block. I'm 
> missing something here. It
> seems org-babel-load-file is creating a config.el from the config.org -- 
> which is a tangle behavior.
>

No, tangling does not run code blocks: it just writes them out to (one
or many) different file(s).  org-babel-load-file calls
org-babel-tangle which is an autoloaded function, so when it is
called, emacs arranges to load the file that defines it
(i.e. ob-tange.el[c]). So you don't need to to (require 'ob-tangle)
separately. I presume the (require 'org) is also unnecessary because
you are loading the org-mode that is bundled with emacs which does that
automatically (but I haven't used the bundled org-mode in a long time,
so take this cum (the appropriately sized) grano salis).

-- 
Nick




reply via email to

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