Skip to content

Instantly share code, notes, and snippets.

@dougbeal
Created April 26, 2013 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougbeal/5471004 to your computer and use it in GitHub Desktop.
Save dougbeal/5471004 to your computer and use it in GitHub Desktop.
Cross platform .emacs file to load configuration from repository
(require 'cl)
(defun load-init-file ()
(let* (
(user (getenv "USER"))
(repo "/git/home")
(locations
(list
(concat "/Users/" user repo)
(concat "/home/" user repo)
(concat "C:/cygwin/home/" user repo )
))
(path nil)
)
(catch 'break
(loop for location in locations
do
(setq path (concat location "/emacs/init.el"))
(add-to-list 'load-path path)
(if (load path t)
(throw 'break path)
(message (concat "Load failed " path))
)
)
)
)
)
(message (concat "load-init-file:" (if (load-init-file) "Succeeded" "Failed")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment