Permalink
Browse files

use relative paths for loading files

  • Loading branch information...
1 parent ea6cd9d commit ca3256254aafe4f116f3caecd85046ce09262fb9 @jimeh committed Feb 13, 2012
Showing with 40 additions and 28 deletions.
  1. +24 −12 init.el
  2. +11 −11 languages.el
  3. +1 −1 languages/erlang.el
  4. +3 −3 packages.el
  5. +1 −1 vendor.el
View
36 init.el
@@ -1,18 +1,30 @@
-;; emacs configuration
+;;
+;; Emacs Configuration
+;;
-(load-file "~/.emacs.d/env.el")
-(load-file "~/.emacs.d/packages.el")
-(load-file "~/.emacs.d/helpers.el")
-(load-file "~/.emacs.d/languages.el")
-(load-file "~/.emacs.d/vendor.el")
-(load-file "~/.emacs.d/behavior.el")
-(load-file "~/.emacs.d/appearance.el")
-(load-file "~/.emacs.d/keybindings.el")
-(load-file "~/.emacs.d/remember.el")
-(load-file "~/.emacs.d/project-definitions.el")
+;; Set root directory of Emacs config
+(setq emacs-config-dir
+ (file-name-directory (or load-file-name (buffer-file-name))))
+
+;; Helper function for config path
+(defun config-path(path)
+ "Appends argument at the end of emacs-config-dir using expand-file-name"
+ (expand-file-name path emacs-config-dir))
+
+;; Load various config files
+(load-file (config-path "env.el"))
+(load-file (config-path "packages.el"))
+(load-file (config-path "helpers.el"))
+(load-file (config-path "languages.el"))
+(load-file (config-path "vendor.el"))
+(load-file (config-path "behavior.el"))
+(load-file (config-path "appearance.el"))
+(load-file (config-path "keybindings.el"))
+(load-file (config-path "remember.el"))
+(load-file (config-path "project-definitions.el"))
;; Custom variables file
-(setq custom-file "~/.emacs.d/custom-variables.el")
+(setq custom-file (config-path "custom-variables.el"))
(load-file custom-file)
;; Initialize packages in packages.el
View
@@ -1,11 +1,11 @@
-(load-file "~/.emacs.d/languages/coffee-script.el")
-(load-file "~/.emacs.d/languages/cucumber.el")
-(load-file "~/.emacs.d/languages/elisp.el")
-(load-file "~/.emacs.d/languages/erlang.el")
-(load-file "~/.emacs.d/languages/javascript.el")
-(load-file "~/.emacs.d/languages/markdown.el")
-(load-file "~/.emacs.d/languages/php.el")
-(load-file "~/.emacs.d/languages/python.el")
-(load-file "~/.emacs.d/languages/shell-script.el")
-(load-file "~/.emacs.d/languages/ruby.el")
-(load-file "~/.emacs.d/languages/yaml.el")
+(load-file (config-path "languages/coffee-script.el"))
+(load-file (config-path "languages/cucumber.el"))
+(load-file (config-path "languages/elisp.el"))
+(load-file (config-path "languages/erlang.el"))
+(load-file (config-path "languages/javascript.el"))
+(load-file (config-path "languages/markdown.el"))
+(load-file (config-path "languages/php.el"))
+(load-file (config-path "languages/python.el"))
+(load-file (config-path "languages/shell-script.el"))
+(load-file (config-path "languages/ruby.el"))
+(load-file (config-path "languages/yaml.el"))
View
@@ -2,7 +2,7 @@
;; no simple way to create a el-get package. So it's one
;; more thing thats not installed through el-get.
-(add-to-list 'load-path "~/.emacs.d/languages/erlang")
+(add-to-list 'load-path (config-path "languages/erlang"))
(setq erlang-root-dir "/usr/local")
(setq exec-path (cons "/usr/local/bin" exec-path))
(require 'erlang-start)
View
@@ -11,7 +11,7 @@
;; Load el-get
;;
-(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
+(add-to-list 'load-path (config-path "el-get/el-get"))
(require 'el-get)
;;; Uses 2.stable branch, doesn't work with some of my stuff
@@ -32,7 +32,7 @@
:type git
:url "git://github.com/jimeh/birds-of-paradise-plus-theme.el.git"
:post-init (lambda ()
- (push "~/.emacs.d/el-get/birds-of-paradise-plus-theme"
+ (push (config-path "el-get/birds-of-paradise-plus-theme")
custom-theme-load-path)))
;; (:name birds-of-paradise-theme
;; :type git
@@ -87,7 +87,7 @@
:url "https://github.com/m2ym/rsense.git"
:build ("ant" "chmod +x bin/rsense")
:post-init (lambda ()
- (setq rsense-home (expand-file-name "~/.emacs.d/el-get/rsense"))
+ (setq rsense-home (expand-file-name (config-path "el-get/rsense")))
(add-to-list 'load-path (concat rsense-home "/etc"))
(require 'rsense)))
(:name ruby-mode
View
@@ -1,2 +1,2 @@
;; Load-path
-(add-to-list 'load-path "~/.emacs.d/vendor")
+(add-to-list 'load-path (config-path "vendor"))

0 comments on commit ca32562

Please sign in to comment.