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.

149 lines
4.9 KiB

  1. ;; Set enironment information
  2. (setq user-full-name "Drew Short")
  3. (setq user-email-address "warrick@sothr.com")
  4. ;; Set UTF-8 as the default encoding
  5. (prefer-coding-system 'utf-8)
  6. (setq coding-system-for-read 'utf-8)
  7. (setq coding-system-for-write 'utf-8)
  8. ;; Load common lisp
  9. (require 'cl)
  10. ;; Package management
  11. (load "package")
  12. (package-initialize)
  13. (defvar sothr/packages '(auto-complete
  14. better-defaults
  15. cyberpunk-theme
  16. gist
  17. magit
  18. markdown-mode
  19. neotree
  20. org
  21. org-ac
  22. org-autolist
  23. org-bullets
  24. org-doing
  25. projectile
  26. slime
  27. go-mode
  28. rust-mode
  29. yaml-mode)
  30. "Default packages")
  31. ;; Repositories
  32. (add-to-list 'package-archives
  33. '("melpa" . "http://melpa.milkbox.net/packages/") t)
  34. (setq package-archive-enable-alist '(("melpa" deft magit)))
  35. ;; Advice from the melpa site for a package dependency validation error in emacs 24
  36. ;;(defadvice package-compute-transaction
  37. ;; (before package-compute-transaction-reverse (package-list requirements) activate compile)
  38. ;; "reverse the requirements"
  39. ;; (setq requirements (reverse requirements))
  40. ;; (print requirements))
  41. ;; Make sure default packages are installed
  42. (defun sothr/packages-installed-p ()
  43. (loop for pkg in sothr/packages
  44. when (not (package-installed-p pkg)) do (return nil)
  45. finally (return t)))
  46. ;; This is the logic that runs the above function
  47. (unless (sothr/packages-installed-p)
  48. (message "%s" "Refreshing package database...")
  49. (package-refresh-contents)
  50. (dolist (pkg sothr/packages)
  51. (when (not (package-installed-p pkg))
  52. (package-install pkg))))
  53. ;; Markdown Mode Configuration
  54. (autoload 'markdown-mode "markdown-mode"
  55. "Major mode for editing Markdown files" t)
  56. (add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
  57. (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
  58. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  59. ;; Set the markdown processor to grip
  60. ;; pip3 install grip
  61. (setq markdown-command "grip --export -")
  62. ;; Set NeoTree to toggle with F8
  63. (global-set-key [f8] 'neotree-toggle)
  64. ;; Default configuration for auto-complete
  65. (ac-config-default)
  66. ;; Make all files show a linenum
  67. (global-linum-mode)
  68. ;; Configure SLIME
  69. ;; Inferior Lisp interpreter is found at $CL_BIN
  70. (setq inferior-lisp-program (getenv "CL_BIN"))
  71. (setq slime-contribs '(slime-fancy))
  72. ;; Load my default theme
  73. ;(load-theme 'cyberpunk t)
  74. ;; A method create a lambda that switches between
  75. ;; themes with the press of a button
  76. ;; Emcas requires explicit closures otherwise they're
  77. ;; abandoned at runtime and cryptic errors occur
  78. (let ((next nil) (themes nil))
  79. (defun make-theme-switcher (theme_list)
  80. (setf themes theme_list)
  81. #'(lambda ()
  82. (setf next (pop themes))
  83. ;; Move the first entry in the list to the last
  84. (setf themes (append themes (list next)))
  85. ;; Load the theme that was next in the list
  86. (load-theme next t))))
  87. ;; create a function to loop over and apply themes
  88. (setf load-next-theme (make-theme-switcher '(cyberpunk adwaita)))
  89. ;; Load the first theme as the default theme
  90. (funcall load-next-theme)
  91. ;; Toggle theme switch with F3
  92. (global-set-key [f3] (lambda ()
  93. (interactive)
  94. (funcall load-next-theme)))
  95. ;; Windows specific configuration
  96. ;; A Linux environment is assumed by default
  97. (defun windows-config ()
  98. ;; When running in Windows, we want to use an alternate shell so we
  99. ;; can be more unixy.
  100. (setq shell-file-name "c:/Tools/msys64/usr/bin/zsh")
  101. (setq explicit-shell-file-name shell-file-name)
  102. (setq explicit-zsh-args '("--login" "-i")) ; Make sure the shell is in the home
  103. (setenv "HOME" "c:/tools/msys64/home/neria") ; Set the home environment correctly
  104. (setenv "PATH"
  105. (concat ".:/usr/local/bin:/msys64/bin:/bin:"
  106. (replace-regexp-in-string " " "\\\\ "
  107. (replace-regexp-in-string "\\\\" "/"
  108. (replace-regexp-in-string "\\([A-Za-z]\\):" "/\\1"
  109. (getenv "PATH")))))))
  110. ;; Windows specific configurations
  111. ; (cond
  112. ; ((string-equal system-type "windows-nt") ; MS Windows System
  113. ; (windows-config)))
  114. (custom-set-variables
  115. ;; custom-set-variables was added by Custom.
  116. ;; If you edit it by hand, you could mess it up, so be careful.
  117. ;; Your init file should contain only one such instance.
  118. ;; If there is more than one, they won't work right.
  119. '(package-selected-packages
  120. (quote
  121. (org-doing org-bullets org-autolist org-ac better-defaults yaml-mode slime rust-mode projectile markdown-mode magit go-mode gist cyberpunk-theme auto-complete))))
  122. (custom-set-faces
  123. ;; custom-set-faces was added by Custom.
  124. ;; If you edit it by hand, you could mess it up, so be careful.
  125. ;; Your init file should contain only one such instance.
  126. ;; If there is more than one, they won't work right.
  127. )