emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* tangle versus org-babel-load-file
@ 2018-04-03 12:54 Lawrence Bottorff
  2018-04-03 16:16 ` Nick Dokos
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Bottorff @ 2018-04-03 12:54 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 952 bytes --]

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.

LB

[-- Attachment #2: Type: text/html, Size: 1371 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tangle versus org-babel-load-file
  2018-04-03 12:54 tangle versus org-babel-load-file Lawrence Bottorff
@ 2018-04-03 16:16 ` Nick Dokos
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2018-04-03 16:16 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-03 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 12:54 tangle versus org-babel-load-file Lawrence Bottorff
2018-04-03 16:16 ` Nick Dokos

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