94 lines
3.0 KiB
EmacsLisp
94 lines
3.0 KiB
EmacsLisp
;;; init.el --- A (reasonably) minimal initialization file for Emacs.
|
|
|
|
|
|
;; Manage package configuration via `use-package`.
|
|
;; https://github.com/jwiegley/use-package
|
|
|
|
(require 'package)
|
|
(setq package-enable-at-startup nil)
|
|
|
|
(setq package-archives
|
|
'(("gnu" . "https://elpa.gnu.org/packages/")
|
|
("melpa" . "https://melpa.org/packages/")
|
|
("stable" . "https://stable.melpa.org/packages/")))
|
|
|
|
(unless (package-installed-p 'use-package)
|
|
(package-refresh-contents)
|
|
(package-install 'use-package))
|
|
|
|
|
|
;; Configure how and where backup files are created.
|
|
|
|
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
|
|
backup-by-copying t ; Don't delink hardlinks
|
|
version-control t ; Use version numbers on backups
|
|
delete-old-versions t ; Automatically delete excess backups
|
|
kept-new-versions 20 ; How many of the newest versions to keep
|
|
kept-old-versions 5 ; How many of the oldest versions to keep
|
|
)
|
|
|
|
|
|
;; On macOS, `ls` does not support the `--dired` option.
|
|
(when (string= system-type "darwin")
|
|
(setq dired-use-ls-dired nil))
|
|
|
|
|
|
;; Define a couple simple helper functions for loading user-defined
|
|
;; configuration files.
|
|
|
|
(defconst user-init-dir "~/.emacs.d/")
|
|
|
|
(defun load-user-file (file)
|
|
"Load FILE in the current user's configuration directory.
|
|
File names which are prefixed with an underscore or which do not have the
|
|
extension '.el' will be ignored."
|
|
(interactive "f")
|
|
(setq file-name (file-name-nondirectory file))
|
|
(when (and (string-suffix-p ".el" file-name)
|
|
(not (string-prefix-p "_" file-name)))
|
|
(load-file (expand-file-name file user-init-dir))))
|
|
|
|
(defun load-user-dir (dir)
|
|
"Recursively load all files in directory DIR.
|
|
DIR should be relative to the user's configuration directory."
|
|
(interactive "f")
|
|
(setq config-dir (file-name-concat user-init-dir dir))
|
|
(dolist (file (directory-files-recursively config-dir ""))
|
|
(load-user-file file)))
|
|
|
|
|
|
;; Load all user-defined configuration files.
|
|
|
|
(load-user-file "editor.el")
|
|
(load-user-file "interface.el")
|
|
(load-user-file "key-bindings.el")
|
|
(load-user-file "theme.el")
|
|
|
|
(load-user-dir "pkg")
|
|
(load-user-dir "lang")
|
|
|
|
|
|
;; Diminish some built-in modes that we don't really care about.
|
|
|
|
(add-hook 'eldoc-mode-hook (lambda () (diminish 'eldoc-mode)))
|
|
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
|
|
|
|
|
|
;; WARNING: Don't touch anything after this comment!
|
|
|
|
(custom-set-variables
|
|
;; custom-set-variables was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
'(git-gutter:added-sign " +")
|
|
'(git-gutter:deleted-sign " -")
|
|
'(git-gutter:modified-sign " *")
|
|
'(package-selected-packages nil))
|
|
(custom-set-faces
|
|
;; custom-set-faces was added by Custom.
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
;; Your init file should contain only one such instance.
|
|
;; If there is more than one, they won't work right.
|
|
)
|