Still had some issues with your function Eric, but finally found the time to make it work on my system. Posting it here since I didn't use <reply all> the first time around, and someone else might find it useful.
(defun my-org-babel-load-file (file) (let ((orig-file (expand-file-name file dotfiles-dir)) (tmp-file (make-temp-file "my-ob-load" nil ".org"))) (with-temp-file tmp-file (insert-file-contents orig-file)) (org-babel-load-file tmp-file))) Thanks for your help ! Cheers On Sat, Jul 3, 2010 at 3:56 AM, Eric Schulte <schulte.e...@gmail.com> wrote: > Hi Julien, > > Org-mode prefers when it is used in buffers that are associated with > files. The following version creates temporary files for each load. It > will litter your /tmp directory instead of your emacs directory -- > although it shouldn't be hard to add a quick cleanup at the end of the > function. > > Cheers -- Eric > > > (defun my-org-babel-load-file (file) > (let ((tmp-file (make-temp-file "my-ob-load"))) > (with-temp-file tmp-file > (insert-file-contents > (expand-file-name file dotfiles-dir)) > (org-mode) > (org-babel-execute-buffer)))) > > > Julien Fantin <julien.fan...@gmail.com> writes: > >> Hi eric, >> I'v been trying to find a way to avoid the tangling involved in using >> org-babel-load-file when loading my config, as it clobbers my emacs directoy >> with files I don't use. >> >> But I'm getting errors with this function : >> >> (defun my-org-babel-load-file (file) >> (with-temp-buffer (insert-file-contents (expand-file-name file >> dotfiles-dir)) >> (org-mode) >> (org-babel-execute-buffer))) >> >> (my-org-babel-load-file "init.org") >> >> It's giving me a hard time apparently due to org-babel-insert-result calling >> orgtbl-to-orgtbl on blocks of emacs-lisp which return nil. >> >> Could you suggest how to do this properly ? >> >> cheers and congratulations on the integration ! >> >> On Mon, Jun 28, 2010 at 7:59 PM, Eric Schulte <schulte.e...@gmail.com>wrote: >> >>> Hi Richard, >>> >>> Happy this is sorted out. A similar startup example is available in the >>> init.el file in my copy of the Emacs Starter Kit [1], which also tangles >>> all configuration from org files. >>> >>> Cheers -- Eric >>> >>> Richard Riley <rile...@gmail.com> writes: >>> >>> > Firstly : Carsten and Eric I emailed you privately as I had no news >>> > access - pls ignore. Problem solved. >>> > >>> > With the latest git pull for org-mode I couldn't start my emacs because >>> > my init files are org files untangled using babel. Here is an updated >>> > init.el which which uses the new names and pulls in ob-tangle. >>> > >>> > >>> > (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" 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 (concat org-dir >>> "/babel")) >>> > (or load-path nil)))) >>> > (message "%s" org-dir) >>> > ;; load up Org-mode and Org-babel >>> > (require 'org-install) >>> > (require 'ob) >>> > (require 'ob-tangle) >>> > ) >>> >>> Footnotes: >>> [1] http://github.com/eschulte/emacs-starter-kit/blob/master/init.el >>> >>> >>> _______________________________________________ >>> 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 >>> > > _______________________________________________ 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