genehack's emacs configuration files and libraries
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.
 
 
 

136 lines
4.4 KiB

  1. ;; init.el -- master configuration file
  2. ;;; Commentary:
  3. ;;; Code:
  4. ;; DEBUG
  5. ;; (setq debug-on-error t)
  6. ;; (setq debug-on-quit t)
  7. ;; VARIABLES
  8. ;;; if you're not me, you probably want to change this to point to
  9. ;;; where you put your checkout of the github repo:
  10. (defvar genehack/emacs-dir (expand-file-name "~/proj/emacs/")
  11. "Directory containing working copy of Emacs config repo.")
  12. (defvar genehack/emacs-config-dir (concat genehack/emacs-dir "etc/")
  13. "Sub-directory containing config files.")
  14. (add-to-list 'load-path genehack/emacs-config-dir)
  15. (defvar genehack/emacs-tmp-dir (concat genehack/emacs-dir "tmp/")
  16. "Scratch space for stuff...")
  17. ;;; I generally don't use the Customize interface, but sometimes
  18. ;;; things get added there. Setting this means the file is under
  19. ;;; revision control, so if something touches it, I'll notice (and
  20. ;;; then I can move stuff to where it really goes and empty out
  21. ;;; custom.el again...)
  22. (setq custom-file (concat genehack/emacs-config-dir "custom.el"))
  23. (load custom-file)
  24. ;; DEFAULT FACE
  25. ;;; If you don't set this early on, sometimes things get wonky.
  26. (if (eq system-type 'darwin)
  27. (set-face-attribute 'default t
  28. :background "#000000"
  29. :foreground "#ffffff"
  30. :family "Fira Code"
  31. :height 180)
  32. (set-face-attribute 'default t
  33. :background "#000000"
  34. :foreground "#ffffff"
  35. :family "Mono"
  36. :height 161))
  37. ;; ELPA
  38. (require 'package)
  39. (setq package-user-dir (concat genehack/emacs-dir "elpa"))
  40. ;;; initialize ELPA, creating package directory if necessary
  41. ;;; (and complaining if we're blocked by a file...)
  42. (if (file-exists-p package-user-dir)
  43. (if (file-directory-p package-user-dir)
  44. (package-initialize)
  45. (error "ELPA package dir creation blocked by file"))
  46. (make-directory package-user-dir))
  47. ;; PRIVATE CONFIG
  48. ;;; Again, you might want to change this path to a private file of
  49. ;;; your own. This is a place to put variables that set passwords,
  50. ;;; email addresses, and other stuff that you don't want in a public
  51. ;;; github repo...
  52. (defvar genehack/private-config-file "~/private/emacs-private.el"
  53. "File with configuration info that can't be in public repository.")
  54. (if (file-readable-p genehack/private-config-file)
  55. (progn
  56. (load-library genehack/private-config-file)
  57. (message "Loaded private config")))
  58. ;; PACKAGES
  59. (eval-after-load "package"
  60. '(setq package-archives
  61. '(("my-melpa" . "https://melpa.genehack.net/packages/")
  62. ("melpa" . "https://melpa.org/packages/")
  63. ("gnu" . "https://elpa.gnu.org/packages/"))))
  64. (defvar genehack/packages-refreshed nil
  65. "Flag for whether package lists have been refreshed yet.")
  66. (defun genehack/package-refresh (&rest args)
  67. "Refresh package metadata, if needed.
  68. Ignores `ARGS'."
  69. (unless (eq genehack/packages-refreshed t)
  70. (progn
  71. (message "Refreshing package metadata...");
  72. (package-refresh-contents)
  73. (setq genehack/packages-refreshed t))))
  74. (advice-add 'package-install :before #'genehack/package-refresh)
  75. ;;; we need use-package -- it'll take care of installing everything
  76. ;;; else
  77. (unless (package-installed-p 'use-package)
  78. (package-install 'use-package))
  79. (require 'use-package)
  80. ;; GARBAGE COLLECTION MAGIC HACK
  81. ;;; speeds startup?
  82. (use-package gcmh
  83. :ensure t
  84. :init (gcmh-mode 1))
  85. ;;; per https://github.com/emacs-lsp/lsp-mode#performance
  86. ;;; 20200421 DISABLED TO SEE IF IT HELPS WITH CRASHING ON SERVERS
  87. ;;(setq read-process-output-max (* 1024 1024)) ;; 1mb
  88. ;;(setq gc-cons-threshold 100000000)
  89. ;; MAKE EMACS PATH MATCH SHELL PATH
  90. (setenv "PLENV_ROOT" "/opt/plenv")
  91. (use-package exec-path-from-shell
  92. :ensure exec-path-from-shell
  93. :init
  94. (setq exec-path-from-shell-check-startup-files nil
  95. exec-path-from-shell-variables
  96. '("PLENV_ROOT" "PATH" "MANPATH" "GOROOT" "GOPATH" "NVM_DIR" "SSH_AUTH_SOCK" "SSH_AGENT_PID"))
  97. (exec-path-from-shell-initialize))
  98. ;; MODULES
  99. ;;; All the rest of the config is split out into individual files, for
  100. ;;; ease of use.
  101. (defvar genehack/module-list
  102. '(
  103. "builtins"
  104. "cc"
  105. "completion"
  106. "keys"
  107. "misc"
  108. "perl"
  109. )
  110. "List of modules to load on startup.")
  111. (dolist (pkg genehack/module-list)
  112. (if (file-readable-p (concat genehack/emacs-config-dir pkg ".el"))
  113. (load-library pkg)))
  114. (provide 'init)
  115. ;;; init.el ends here