rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

init.el (3771B)


      1 ;;; init.el  --- initialize
      2 
      3 ;; Author: Mark Feller <mark.feller@member.fsf.org>
      4 
      5 ;; This file is not part of GNU Emacs.
      6 
      7 ;; This file is free software; you can redistribute it and/or modify
      8 ;; it under the terms of the GNU General Public License as published by
      9 ;; the Free Software Foundation; either version 3, or (at your option)
     10 ;; any later version.
     11 
     12 ;; This file is distributed in the hope that it will be useful,
     13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 ;; GNU General Public License for more details.
     16 
     17 ;; You should have received a copy of the GNU General Public License
     18 ;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
     19 
     20 ;;; Commentary:
     21 
     22 ;;; Code:
     23 
     24 ;;---------------------------------------------------------------------
     25 ;; Init
     26 ;;---------------------------------------------------------------------
     27 
     28 (defvar current-user
     29   (getenv
     30    (if (equal system-type 'windows-nt) "USERNAME" "USER")))
     31 
     32 (message "Powering up... Be patient, Master %s!" current-user)
     33 
     34 (when (version< emacs-version "24.4")
     35   (error "Requires at least GNU Emacs 24.4, but you're running %s" emacs-version))
     36 
     37 ;; Always load newest byte code
     38 (setq load-prefer-newer t)
     39 
     40 ;; reduce the frequency of garbage collection by making it happen on
     41 ;; each 50MB of allocated data (the default is on every 0.76MB)
     42 (setq gc-cons-threshold 50000000)
     43 
     44 ;; warn when opening files bigger than 100MB
     45 (setq large-file-warning-threshold 100000000)
     46 
     47 (setq inhibit-startup-echo-area-message t)
     48 
     49 ;;---------------------------------------------------------------------
     50 ;; Variables and Load Paths
     51 ;;---------------------------------------------------------------------
     52 
     53 (defvar emacs-dir (file-name-directory "~/.config/emacs/")
     54   "The root dir of the Emacs distribution.")
     55 
     56 (defvar core-dir (expand-file-name "core" emacs-dir)
     57   "The home of core functionality.")
     58 
     59 (defvar modules-dir (expand-file-name "modules" emacs-dir)
     60   "This directory houses all of the modules.")
     61 
     62 (defvar lisp-dir (expand-file-name "lisp" emacs-dir)
     63   "This directory houses user lisp and site lisp")
     64 
     65 (if (file-exists-p (concat emacs-dir "src"))
     66   (setq source-directory (concat emacs-dir "src")))
     67 
     68 (add-to-list 'load-path core-dir)
     69 (add-to-list 'load-path modules-dir)
     70 (add-to-list 'load-path lisp-dir)
     71 
     72 ;; load the custom file
     73 (setq custom-file "~/.cache/emacs-custom.el")
     74 (unless (file-exists-p custom-file)
     75   (write-region "" nil custom-file))
     76 (load custom-file)
     77 
     78 (require 'init-preload-local nil t)
     79 
     80 ;;---------------------------------------------------------------------
     81 ;; Core
     82 ;;---------------------------------------------------------------------
     83 
     84 (message "Loading core...")
     85 
     86 (require 'core-bootstrap)
     87 (require 'core-ui)
     88 (when (eq system-type 'darwin) (require 'core-macos))
     89 (require 'core-packages)
     90 (require 'core-defuns)
     91 (require 'core-paths)
     92 
     93 ;;---------------------------------------------------------------------
     94 ;; Modules
     95 ;;---------------------------------------------------------------------
     96 
     97 (message "Loading modules...")
     98 
     99 (require 'module-c)
    100 (require 'module-company)
    101 (require 'module-docker)
    102 (require 'module-eldoc)
    103 (require 'module-elfeed)
    104 (require 'module-emacs-lisp)
    105 (require 'module-eshell)
    106 (require 'module-evil)
    107 (require 'module-git)
    108 (require 'module-go)
    109 (require 'module-ledger)
    110 (require 'module-lsp)
    111 (require 'module-multiple-cursors)
    112 (require 'module-notmuch)
    113 (require 'module-org)
    114 (require 'module-projectile)
    115 (require 'module-python)
    116 (require 'module-restclient)
    117 (require 'module-vterm)
    118 (require 'module-yaml)
    119 (require 'module-yasnippet)
    120 
    121 ;; load any custom user provided locals
    122 (require 'init-local nil t)
    123 
    124 (message "Ready to do thy bidding, Master %s!" current-user)
    125 
    126 ;;; init.el ends here