You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

67 lines
2.3 KiB

  1. ;;-*-mode: emacs-lisp; coding: utf-8;-*-
  2. ;; In case I screw up something later, debug stuff
  3. (setq debug-on-error t)
  4. ;; Simplify os detection a skosh
  5. (defvar mswindows-p (string-match "windows" (symbol-name system-type))
  6. "Am I running under windows?")
  7. (defvar osx-p (string-match "darwin" (symbol-name system-type))
  8. "Am I running under osx?")
  9. (defvar linux-p (string-match "gnu/linux" (symbol-name system-type))
  10. "Am I running under linux?")
  11. ;; Yes, I miss perl chomp, sue me
  12. (defun chomp (str)
  13. "Chomp leading and trailing whitespace from STR."
  14. (let ((s (if (symbolp str) (symbol-name str) str)))
  15. (replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" s)))
  16. ;; I'm not about to redo logic to setup PATH in emacs that I have in
  17. ;; .profile/.*shrc crap.
  18. ;; So, just use whatever PATH had when we were run.
  19. (defun set-exec-path-from-shell-PATH ()
  20. (let ((path-from-shell
  21. (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
  22. (setenv "PATH" path-from-shell)
  23. (setq exec-path (split-string path-from-shell path-separator))))
  24. ;; This is really only needed when the gui emacs runs.
  25. (if osx-p
  26. (set-exec-path-from-shell-PATH)
  27. )
  28. ;; Base directory
  29. (defvar load-base "~/.emacs.d" "Where the emacs directory is kept")
  30. ;; Bootstrap load path
  31. (add-to-list 'load-path load-base)
  32. ;; Temp file dir (unixes)
  33. (setq temporary-file-directory "/tmp")
  34. ;; Set the default temp file dir for the current user based off username
  35. (defvar user-temporary-file-directory
  36. (format "%s/%s" temporary-file-directory user-login-name))
  37. ;; mkdir for temporary-file-directory if needed
  38. (unless (file-accessible-directory-p user-temporary-file-directory)
  39. (make-directory user-temporary-file-directory t))
  40. ;; Load up settings of things, in no particular order or anything
  41. (mapcar 'load-file (directory-files "~/.emacs.d/settings/" t ".*.el$"))
  42. ;; Setup/install third party packages using builtin package manager.
  43. (load "emacs-package")
  44. ;; Load up settings for things that el-get installed
  45. (mapcar 'load-file (directory-files "~/.emacs.d/package-settings/" t ".*.el$"))
  46. ;; Cleanup startup buffers
  47. (add-hook 'after-init-hook
  48. '(lambda () (load "after-init")))
  49. ;; Fine, emacsclient -c and emacs --daemon don't mix well
  50. ;; From now on I start emacs as a gui and have this startup the daemon
  51. (load "server")
  52. (unless (server-running-p) (server-start))