emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: tangle versus org-babel-load-file
Date: Tue, 03 Apr 2018 12:16:40 -0400	[thread overview]
Message-ID: <87h8osuuxj.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: CAFAhFSXfVRz=AbPh9VK_D+FEuoH6gvqN_86gqqxT+HDRTm9mxQ@mail.gmail.com

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

      reply	other threads:[~2018-04-03 16:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 12:54 tangle versus org-babel-load-file Lawrence Bottorff
2018-04-03 16:16 ` Nick Dokos [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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8osuuxj.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@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.
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).