(require 'package) ;; Security for packages - force HTTPS on everything. (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (package-initialize) (setq inhibit-startup-message t) ;; Add custom code to load path. (add-to-list 'load-path "~/.emacs.d/elisp") (add-to-list 'load-path "~/.emacs.d/elisp/modes") ;; Before doing anything else ensure that use-package is installed ;; for later work. (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (eval-and-compile (setq use-package-always-ensure t use-package-expand-minimally t)) ;;----------------------------------------------------- ;; 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) ;;--------------------------------- ;; Prefer unix style line endings. ;;--------------------------------- (set-buffer-file-coding-system 'unix) ;;--------------------------------------------------- ;; Populate emacs path to $PATH when on *nix or OS X. ;;--------------------------------------------------- (use-package exec-path-from-shell :ensure t) (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize)) ;;------------------------------------ ;; Delete trailing whitespace on save. ;;------------------------------------ (add-hook 'before-save-hook 'delete-trailing-whitespace) ;;---------------------------------------------- ;; When a file is updated by an external program ;; (such as git), update the buffer. ;;---------------------------------------------- (global-auto-revert-mode t) ;;------------------------------- ;; Stop the annoying features. ;;------------------------------- (setq visible-bell t) ;; ... and the flashing (setq ring-bell-function 'ignore) ;; Bug with Darwin that effects Emacs 28. ;; Causes ld log spam. This can be removed ;; in Emacs 29. (when (eq system-type 'darwin) (customize-set-variable 'native-comp-driver-options '("-Wl,-w"))) ;;-------------------------------------- ;; 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) ;; Send custom-set-variables type spam to another file. (when (file-exists-p "~/.emacs.d/elisp/custom.el") (setq custom-file "~/.emacs.d/elisp/custom.el") (load custom-file)) ;;------------------------- ;; Load modes and keybinds. ;;------------------------- ;; Order is important here - default-modes must be loaded first! (load-library "default-modes") (load-library "ui") (load-library "git") (load-library "markdown-mode-settings") (load-library "json-mode-settings") (load-library "python-mode-settings") (load-library "lisp-mode-settings") (load-library "ibuffer-settings") (load-library "keybinds") ;; Load anything private (when (file-exists-p "~/.emacs.d/elisp/private.el") (load "~/.emacs.d/elisp/private.el")) ;; Start an emacs server so other things (such as mail clients) can quickly use Emacs. (server-start)