split init.el
[emacs.git] / .emacs.d / init.el
index f038db5..63214b9 100644 (file)
 ;; seconds), so save the start time
 (defvar emacs-load-start-time (current-time))
 
 ;; seconds), so save the start time
 (defvar emacs-load-start-time (current-time))
 
-;; We will need a set of directories for stuff
-;; Lets define some variables for them
-
-;; I might have special configuration based on various states
-;; First we set an own variable, as system-type from emacs directly is
-;; useless. gnu/linux and gnu/kfreebsd have extra /, which is plenty annoying
-;; when you want to use them in a path entry.
-(defun jj-system-type ()
-  "Return a string depending on the OS we use"
-  (interactive)
-  (cond
-   ((eq system-type 'darwin) "macosx")
-   ((eq system-type 'gnu/linux) "linux")
-   ((eq system-type 'gnu/kfreebsd) "kfreebsd")
-   ((eq system-type 'cygwin) "cygwin")
-   ((eq system-type 'windows-nt) "windows")))
-
-
-(defvar jj-dir (file-name-directory (or load-file-name (buffer-file-name)))
-  "The master directory for Ganneffs emacs configuration and storage.
-Usually ~/.emacs.d/")
-(defvar jj-config-dir
-  (expand-file-name "config" jj-dir)
-  "Ganneffs main emacs configuration can be found here.")
-(defvar jj-emacs-config
-  (expand-file-name "emacs.org" jj-config-dir)
-  "Ganneffs main emacs configuration file.")
-(defvar jj-elisp-dir
-  (expand-file-name "elisp" jj-dir)
-  "This directory stores subdirs for local packages in Ganneffs emacs config.")
-(defvar jj-elisp-local-dir
-  (expand-file-name "local" jj-elisp-dir)
-  "This directory stores extra elisp files for Ganneffs emacs config.")
-(defvar jj-custom-file
-  (expand-file-name "customized.el" jj-config-dir)
-  "Changes from the customization interface in Ganneffs emacs config.")
-(defvar jj-cache-dir
-  (expand-file-name "cache" jj-dir)
-  "This directory stores cache files and other volatile data.")
-(defvar jj-backup-directory
-  (expand-file-name (concat "emacs-autosave-" user-login-name) jj-cache-dir)
-  "This directory stores backup files.")
-(defvar jj-theme-dir
-  (expand-file-name "themes" jj-dir)
-  "This directory stores theme files for Ganneffs emacs config")
-
-(defvar jj-sys-config
-  (expand-file-name (concat system-name ".org") jj-config-dir)
-  "Ganneffs System/Host specific emacs configiraton file.")
-(defvar jj-os-config
-  (expand-file-name (concat (jj-system-type) ".org") jj-config-dir)
-  "Ganneffs Operating system specific emacs configuration file.")
-(defvar jj-user-config
-  (expand-file-name (concat user-login-name ".org") jj-config-dir) 
-  "Ganneffs username specific emacs configuration file.")
-(defvar jj-ev-config (expand-file-name
-                      (concat "emacs"
-                              (number-to-string emacs-major-version) ".org")
-                      jj-config-dir)
-  "Ganneffs emacs version specific configuration file.")
-(defvar jj-color-style 'dark "Which color scheme of solarized to select. Dark or Light")
-
-;; Ensure that the cache directory hierarchy exists
-(if (not (file-exists-p jj-cache-dir))
-    (make-directory jj-cache-dir))
-(if (not (file-exists-p jj-backup-directory))
-    (make-directory jj-backup-directory))
-
 ;; Set path to (my, recent) Org-Mode version
 (add-to-list 'load-path (concat jj-elisp-dir "/org/"))
 ;; Set path to (my, recent) Org-Mode version
 (add-to-list 'load-path (concat jj-elisp-dir "/org/"))
-;; Have use-package/bindkey in here wich are needed for startup
-(add-to-list 'load-path jj-elisp-local-dir)
 
 ;; As we use org-mode/org-babel/org-tangle to extract the real emacs
 ;; config out of the org-mode files, we have to load that first.
 
 ;; As we use org-mode/org-babel/org-tangle to extract the real emacs
 ;; config out of the org-mode files, we have to load that first.
@@ -99,49 +29,8 @@ Usually ~/.emacs.d/")
                     org-id org-info org-jsinfo org-habit org-inlinetask
                     org-irc org-protocol org-w3m org-mouse org-checklist
                     org-notmuch icalendar)))
                     org-id org-info org-jsinfo org-habit org-inlinetask
                     org-irc org-protocol org-w3m org-mouse org-checklist
                     org-notmuch icalendar)))
+
 (require 'org-install)
 (require 'ob-tangle)
 (require 'org-install)
 (require 'ob-tangle)
+(org-babel-load-file (expand-file-name "initjj.org" (file-name-directory (or load-file-name (buffer-file-name)))))
 
 
-(defvar jj-init-files '() "Temporary list of files that need a byte-compile")
-(defun jj-byte-compile-init ()
-  "Byte compile a list of files"
-  (let (filename)
-    (dolist (filename jj-init-files)
-      (when (file-exists-p filename)
-        (message "Byte-compiling %s, standby" filename)
-        (byte-compile-file filename))))
-  (makunbound 'jj-init-files)
-  (makunbound 'jj-byte-compile-init)
-  )
-(defun jj-compile-and-load (&optional arg)
-  "Use org-tangle to get the emacs-lisp parts from .org emacs
-config files into .el ones, byte-compile those and then load
-them."
-  (let ((el-file (concat (file-name-sans-extension arg) ".el")))
-    (cond
-     ((file-newer-than-file-p arg el-file)
-      (org-babel-tangle-file arg el-file "emacs-lisp")
-      (add-hook 'after-init-hook 'jj-byte-compile-init)
-      (add-to-list 'jj-init-files (symbol-value 'el-file))))
-    (load-file el-file)
-    ))
-
-;; Now read my config
-;; Note that those files *can* include further files.
-;; The basic config is always loaded, no matter where we start emacs.
-(jj-compile-and-load jj-emacs-config)
-
-;; All the others are optional. We try the order of os, system, user
-;; specific files and load them, should they be there
-(if (file-exists-p jj-os-config)   (jj-compile-and-load jj-os-config))
-(if (file-exists-p jj-sys-config)  (jj-compile-and-load jj-sys-config))
-(if (file-exists-p jj-user-config) (jj-compile-and-load jj-user-config))
-(if (file-exists-p jj-ev-config)   (jj-compile-and-load jj-ev-config))
-
-(makunbound 'jj-compile-and-load)
-
-;; Lets get a message about startup time out
-(when (require 'time-date nil t)
-  (message "Emacs startup time: %d seconds."
-           (time-to-seconds (time-since emacs-load-start-time)))
-  )