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.
180 lines
6.7 KiB
180 lines
6.7 KiB
;;; init.el -- Emacs initialization file. |
|
;;; |
|
;;; Commentary: |
|
;;; |
|
;;; This file is broken out to be modular. |
|
;;; The following directories are used: |
|
;;; |
|
;;; ~/.emacs.d/elisp - Contains all customization. |
|
;;; ~/.emacs.d/elisp/modes - Refers to mode specific functions. |
|
;;; |
|
;;; General initialization code, theming, and global settings are stored here for now. |
|
;;; I may move them into a global configuration file later if this gets too crowded |
|
;;; again. |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Enable MELPA |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(require 'package) |
|
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) |
|
(not (gnutls-available-p)))) |
|
(proto (if no-ssl "http" "https"))) |
|
(when no-ssl |
|
(warn "\ |
|
Your version of Emacs does not support SSL connections, |
|
which is unsafe because it allows man-in-the-middle attacks. |
|
There are two things you can do about this warning: |
|
1. Install an Emacs version that does support SSL and be safe. |
|
2. Remove this warning from your init file so you won't see it again.")) |
|
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired |
|
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) |
|
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) |
|
(when (< emacs-major-version 24) |
|
;; For important compatibility libraries like cl-lib |
|
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) |
|
|
|
(when (< emacs-major-version 27) |
|
(package-initialize)) |
|
|
|
(add-to-list 'package-archives |
|
'("melpa-stable" . "https://stable.melpa.org/packages/") t) |
|
|
|
;; This will force any out of date packages to update automatically |
|
(when (not package-archive-contents) |
|
(package-refresh-contents)) |
|
|
|
;; Bootstrap use-package if it doesn't exist |
|
(when (not (package-installed-p 'use-package)) |
|
(package-refresh-contents) |
|
(package-install 'use-package)) |
|
|
|
(require 'use-package) |
|
|
|
(add-to-list 'load-path "~/.emacs.d/elisp") |
|
(add-to-list 'load-path "~/.emacs.d/elisp/modes") |
|
|
|
(setq custom-file "~/.emacs.d/elisp/custom.el") |
|
(when (file-exists-p custom-file) |
|
(load custom-file)) |
|
|
|
|
|
;; Load the package.el file |
|
(load-library "package") |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Turn off the startup screen |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(setq inhibit-startup-screen t) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Quit Beeping |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(setq visible-bell t) |
|
|
|
;; ... and the flashing |
|
(setq ring-bell-function 'ignore) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Emacs 27+ Configs |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
;; Set the directory to the home directory. This has the side effect of making |
|
;; emacs load files from the home directory when called as emacs -nw xyz. |
|
(when (>= emacs-major-version 27) |
|
(setq default-directory "~/") |
|
(setq command-line-default-directory "~/")) |
|
|
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Display battery life in modeline |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(display-battery-mode 1) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Set auto-save and backup directory to the temporary file directory in order |
|
;; to keep projects free of annoying backups. |
|
;;-------------------------------------------------------------------------------------- |
|
(setq backup-directory-alist |
|
`((".*" . ,temporary-file-directory))) |
|
(setq auto-save-file-name-transforms |
|
`((".*" ,temporary-file-directory t))) |
|
|
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Always follow symbolic links to version controlled files |
|
;; |
|
;; I prefer this option because I generally only get this message when I edit |
|
;; a dotfile under version control, and repeatedly typing "yes" is annoying. |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(setq vc-follow-symlinks t) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Enable Org-mode and set agenda files |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(require 'org) |
|
|
|
;; Stuff all of the org files you want under ~/org and they will be loaded automatically |
|
;; and have their TODO items accessible by typing C-c a t |
|
(setq org-agenda-files '("~/org")) |
|
(setq org-log-done t) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Prefer unix style line endings |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(set-buffer-file-coding-system 'unix) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Populate emacs path to $PATH when on *nix or OS X |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(when (memq window-system '(mac ns x)) |
|
(exec-path-from-shell-initialize)) |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Enable auto-refresh to keep buffers up to date when git or another program |
|
;; modifies them |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(global-auto-revert-mode t) |
|
|
|
|
|
(load-library "ibuffer-settings.el") |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Modes |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(require 'use-package) |
|
|
|
(load-library "default-modes") |
|
(load-library "lisp-mode-settings") |
|
(load-library "python-mode-settings") |
|
(load-library "ruby-mode-settings") |
|
(load-library "c-mode-settings") |
|
|
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Save hooks |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(add-hook 'before-save-hook 'delete-trailing-whitespace) |
|
|
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Keybinds |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(load-library "keybinds") |
|
|
|
;;-------------------------------------------------------------------------------------- |
|
;; Theming |
|
;;-------------------------------------------------------------------------------------- |
|
|
|
(load-theme 'arjen-grey t)
|
|
|