emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Fantin <julien.fantin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: org-babel-load-file can't use properties drawers ?
Date: Sun, 28 Feb 2010 21:57:29 +0100	[thread overview]
Message-ID: <e86166cb1002281257u20d22d41u5365443ef1c5a358@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2257 bytes --]

I've been using this init file to load my org-mode-contained emacs
configuration  :

;;; init.el --- Where all the magic begins
;;
;; This file loads both
;; - Org-mode : http://orgmode.org/ and
;; - Org-babel:
http://orgmode.org/worg/org-contrib/babel/org-babel.php#library-of-babel
;;
;; It then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.
;; Load up Org Mode and Org Babel for elisp embedded in Org Mode files
(setq dotfiles-dir (file-name-directory (or (buffer-file-name)
load-file-name)))

(let* ((org-dir (expand-file-name
                 "lisp" (expand-file-name
                         "org-mode" (expand-file-name
                                "elisp" dotfiles-dir))))
       (org-contrib-dir (expand-file-name
                         "lisp" (expand-file-name
                                 "contrib" (expand-file-name
                                            ".." org-dir))))
       (load-path (append (list org-dir org-contrib-dir)
                          (or load-path nil))))
  ;; load up Org-mode and Org-babel
  (require 'org-install)
  (require 'org-babel-init)
  (require 'org-babel-emacs-lisp))
;; load up all literate org-mode files in this directory
(mapc 'org-babel-load-file (directory-files dotfiles-dir t "\\.org$"))
;;; init.el ends here


It's been working nicely until I tried to clean things up by setting some
commonly used variables  in properties drawers, and access them from
emacs-lisp src blocks.

The following illustrates my intent, and will behave as expected with
org-babel-execute-buffer, but fails when it is loaded by org-babel-load-file
:

* Configuration
:PROPERTIES:
:ELISP-DIR:~/emacs.d/elisp/
:END:

** Load Path
#+begin_src emacs-lisp
(add-to-list 'load-path (org-entry-get nil "ELISP-DIR" t))
#+end_src

From my understanding, orb-babel-load-file tangles then loads the file,
losing the variables in the process.

I've been using this function to get the expected behaviour, but the default
somewhat breaks expectations, don't you think ?
 (defun
        ba/org-babel-load-file (file) (with-temp-buffer
(insert-file-contents
        file) (org-mode) (org-babel-execute-buffer)))

Or, is there a cleaner way to achieve this ?

Regards,
julien

[-- Attachment #1.2: Type: text/html, Size: 3317 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-02-28 20:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28 20:57 Julien Fantin [this message]
2010-02-28 21:59 ` [babel] org-babel-load-file can't use properties drawers ? Dan Davison
2010-03-22 14:52 ` Eric Schulte

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=e86166cb1002281257u20d22d41u5365443ef1c5a358@mail.gmail.com \
    --to=julien.fantin@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).