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