added emacs files
[emacs.git] / .emacs.d / init.el
1 ;; I like to see how long it takes to "boot" emacs (usually one or two
2 ;; seconds), so safe the start time
3 (setq emacs-load-start-time (current-time))
4
5 ;; Set path to (my, recent) Org-Mode version
6 (add-to-list 'load-path "~/elisp/org/")
7
8 ;; Set up dotfiles-dir variable, for easier reference later
9 (setq dotfiles-dir (expand-file-name "config"
10 (file-name-directory
11 (or load-file-name (buffer-file-name)))))
12
13 ;; I might have special configuration based on various states
14 ;; First we set an own variable, as system-type from emacs directly is
15 ;; useless. gnu/linux and gnu/kfreebsd have extra /, which is plenty annoying
16 ;; when you want to use them in a path entry.
17 (defun jj-system-type ()
18 "Return a string depending on the OS we use"
19 (interactive)
20 (cond
21 ((eq system-type 'darwin) "macosx")
22 ((eq system-type 'gnu/linux) "linux")
23 ((eq system-type 'gnu/kfreebsd) "kfreebsd")
24 ((eq system-type 'cygwin) "cygwin")
25 ((eq system-type 'windows-nt) "windows")))
26
27 ;; Setup some variables for files I might want to load later.
28 ;; Those are config files that are specific to
29 ;; - the system my emacs runs on
30 ;; - the os emacs is on
31 ;; - the user name I have
32 (setq jj-sys-config (concat dotfiles-dir "/" system-name ".org"))
33 (setq jj-os-config (concat dotfiles-dir "/" (jj-system-type) ".org"))
34 (setq jj-user-config (concat dotfiles-dir "/" user-login-name ".org"))
35
36 ;; As we use org-mode/org-babel/org-tangle to extract the real emacs
37 ;; config out of the org-mode files, we have to load that first.
38 (setq org-modules (quote (org-bbdb org-bibtex org-crypt org-docview org-gnus org-id org-info org-jsinfo org-habit org-inlinetask org-irc org-protocol org-w3m org-mouse org-checklist org-notmuch icalendar)))
39 (require 'org-install)
40 (require 'ob-tangle)
41
42 ;; Now read my config
43 ;; Note that those files *can* include further files.
44
45 ;; The basic config is always loaded, no matter where we start emacs.
46 (org-babel-load-file (expand-file-name "emacs.org" dotfiles-dir))
47
48 ;; All the others are optional We try the order of os, system, user
49 ;; specific files and load them, should they be there
50 (if (file-exists-p jj-os-config)
51 (org-babel-load-file (expand-file-name jj-os-config dotfiles-dir)))
52 (if (file-exists-p jj-sys-config)
53 (org-babel-load-file (expand-file-name jj-sys-config dotfiles-dir)))
54 (if (file-exists-p jj-user-config)
55 (org-babel-load-file (expand-file-name jj-user-config dotfiles-dir)))
56
57 ;; Lets get a message about startup time out
58 (when (require 'time-date nil t)
59 (message "Emacs startup time: %d seconds." (time-to-seconds (time-since emacs-load-start-time)))
60 )