+;; Ganneff's emacs config
+
+;; Emacs can not read its config directly from org-mode files.
+;; But as my config nearly completly is inside an org-mode file,
+;; emacs need to be told to deal with it.
+;; Meet org-tangle/org-babel-load-file, which extracts the emacs-lisp
+;; source parts of my config files, writes them into .el files
+;; and then lets emacs load those.
+
+;; That way I have a nice environment to edit and comment - and easily export
+;; to web or elsewhere - while emacs has its elisp. The initial run after
+;; a config change takes longer, but as that only happens when I change
+;; something in the .org files - I don't care.
+
+;; Go go go
+(message "Emacs is powering up... Be patient, Master %s!" (getenv "USER"))
+
;; I like to see how long it takes to "boot" emacs (usually one or two
-;; seconds), so safe the start time
+;; seconds), so save the start time
(setq emacs-load-start-time (current-time))
-;; Set path to (my, recent) Org-Mode version
-(add-to-list 'load-path "~/elisp/org/")
-
-;; Set up dotfiles-dir variable, for easier reference later
-(setq dotfiles-dir (expand-file-name "config"
- (file-name-directory
- (or load-file-name (buffer-file-name)))))
+;; 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
((eq system-type 'cygwin) "cygwin")
((eq system-type 'windows-nt) "windows")))
-;; Setup some variables for files I might want to load later.
-;; Those are config files that are specific to
-;; - the system my emacs runs on
-;; - the os emacs is on
-;; - the user name I have
-(setq jj-sys-config (concat dotfiles-dir "/" system-name ".org"))
-(setq jj-os-config (concat dotfiles-dir "/" (jj-system-type) ".org"))
-(setq jj-user-config (concat dotfiles-dir "/" user-login-name ".org"))
+
+(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-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-elisp-dir (expand-file-name "elisp" jj-dir)
+ "This directory stores subdirs for packages locally put into 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)
+ "Where do changes from the customization interface end 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")
+
+;; 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/"))
+;; 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.
-(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)))
+(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)))
(require 'org-install)
(require 'ob-tangle)
;; Note that those files *can* include further files.
;; The basic config is always loaded, no matter where we start emacs.
-(org-babel-load-file (expand-file-name "emacs.org" dotfiles-dir))
+(org-babel-load-file jj-emacs-config)
-;; All the others are optional We try the order of os, system, user
+;; 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)
- (org-babel-load-file (expand-file-name jj-os-config dotfiles-dir)))
-(if (file-exists-p jj-sys-config)
- (org-babel-load-file (expand-file-name jj-sys-config dotfiles-dir)))
-(if (file-exists-p jj-user-config)
- (org-babel-load-file (expand-file-name jj-user-config dotfiles-dir)))
+(if (file-exists-p jj-os-config) (org-babel-load-file jj-os-config ))
+(if (file-exists-p jj-sys-config) (org-babel-load-file jj-sys-config))
+(if (file-exists-p jj-user-config) (org-babel-load-file jj-user-config))
;; 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)))
+ (message "Emacs startup time: %d seconds."
+ (time-to-seconds (time-since emacs-load-start-time)))
)
+; (message (concat "Emacs startup time: " (emacs-init-time)))
+
+