emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tony Day <zygomega@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: emacs initialization files in org mode
Date: Sat, 12 Jan 2013 15:16:47 +1100	[thread overview]
Message-ID: <E94EC8A3-39C1-48F0-B4A6-0BA987BA7D5B@gmail.com> (raw)
In-Reply-To: <m24niu8b0i.fsf@polytechnique.org>


On 7 Jan 2013, at 04:41, Alan Schmitt <alan.schmitt@polytechnique.org> wrote:

> The bare minimum one can do is:
> - rename the current init.el into myinit.org
> - add the lines "#+begin_src emacs-lisp" as the first line, and
> "+end_src" as the last line
> - adapt the init.el from emacs-starter-kit as follows
> #+BEGIN_SRC emacs-lisp
> (add-hook 'after-init-hook
> `(lambda ()
>    ;; remember this directory
>    (setq emacsd-dir
>          ,(file-name-directory (or load-file-name (buffer-file-name))))
>    ;; load up the starter kit
>    (require 'org)
>    (org-babel-load-file (expand-file-name "myinit.org" emacsd-dir))))
> #+END_SRC
> 

When emacs boots its expectations for an init.el are hardwired in.  It doesn't know about org-mode goodness yet.  So my minimum init.el is:

#+Begin_src emacs-lisp :tangle init.el :var tangled-in=(buffer-file-name)
  (setq user-emacs-directory
        (file-name-directory (or load-file-name user-emacs-directory "~/.emacs.d/")))
  (defvar org-dir
  "site-lisp/org-mode/lisp"
  "location of the directory containing org-mode")
  (add-to-list 'load-path (expand-file-name org-dir user-emacs-directory))
  (defvar dotemacs-org-file
  "dotemacs.org"
  "Name of the org file containing the main startup code")
  (if (boundp 'tangled-in)
     (setq dotemacs-org-file tangled-in))
  (org-babel-load-file (expand-file-name dotemacs-org-file user-emacs-directory))
#+end_src

And this has to be tangled before emacs loads or it will load the old version of init.el.  It's a good idea to tell emacs straight away where your org directory is or you might end up with the nasty split org version hassle where half of org is the old emacs version and half is the shiny new repository.

https://github.com/tonyday567/dotemacs.org for my messy orgish dot files, which are mostly orgified https://github.com/jwiegley/dot-emacs, or eric's orgified starter kit:
https://github.com/eschulte/emacs24-starter-kit

Tony

  reply	other threads:[~2013-01-12  4:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 17:41 emacs initialization files in org mode Alan Schmitt
2013-01-12  4:16 ` Tony Day [this message]
2013-01-13 11:08   ` Alan Schmitt

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=E94EC8A3-39C1-48F0-B4A6-0BA987BA7D5B@gmail.com \
    --to=zygomega@gmail.com \
    --cc=alan.schmitt@polytechnique.org \
    --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).