emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* emacs initialization files in org mode
@ 2013-01-06 17:41 Alan Schmitt
  2013-01-12  4:16 ` Tony Day
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2013-01-06 17:41 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

After having read about the emacs-starter-kit on the list, I really
like the idea of having my initialization files in org-mode. As I have
many customizations already made, I don't want to dump everything to
use esk. What I want is doing the same with my own keybindings and
customizations. So I went and had a look at the code, and it seems
it's fairly trivial to do. If I have missed something, please don't
hesitate to let me know.

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

Then one can start editing the myinit.org so that it is not just a
big chunk of code.

Alan

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

* Re: emacs initialization files in org mode
  2013-01-06 17:41 emacs initialization files in org mode Alan Schmitt
@ 2013-01-12  4:16 ` Tony Day
  2013-01-13 11:08   ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Day @ 2013-01-12  4:16 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode


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

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

* Re: emacs initialization files in org mode
  2013-01-12  4:16 ` Tony Day
@ 2013-01-13 11:08   ` Alan Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2013-01-13 11:08 UTC (permalink / raw)
  To: Tony Day; +Cc: emacs-orgmode

Tony Day writes:

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

This is a very useful suggestion, thanks a lot.

Alan

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

end of thread, other threads:[~2013-01-13 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-06 17:41 emacs initialization files in org mode Alan Schmitt
2013-01-12  4:16 ` Tony Day
2013-01-13 11:08   ` Alan Schmitt

Code repositories for project(s) associated with this 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).