refactor: clean up init.el to only contain bare-minimum

This commit is contained in:
Laurens Miers 2023-06-06 10:32:53 +02:00
parent 342307ce23
commit f90a75154e

32
init.el
View file

@ -1,22 +1,3 @@
;; IMPORTANT: add (require 'package), else package-archives is not declared (void-variable)
(require 'package)
(setq package-enable-at-startup nil)
;; add melpa-stable to package-archives
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("org" . "https://orgmode.org/elpa/") t)
;; MUST be called after package-archives is updated
(package-initialize)
;;; Bootstrapping use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;;; Increase garbage collection threshold during init but leave it to the default value after
;;; There are a LOT of articles/sites/... discussing this:
;;; https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
@ -24,12 +5,13 @@
;;; ...
(let ((gc-cons-threshold most-positive-fixnum))
;; This is the actual config file. It is omitted if it doesn't exist so emacs won't refuse to launch.
(when (file-readable-p "~/.emacs.d/config.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
(defvar config-file (expand-file-name "config.org" user-emacs-directory))
(defvar project-file (expand-file-name "project.org" user-emacs-directory))
(when (file-readable-p config-file)
(org-babel-load-file (expand-file-name config-file)))
;; If it exists, load some project-specific configurations.
(when (file-readable-p "~/.emacs.d/project.org")
(org-babel-load-file (expand-file-name "~/.emacs.d/project.org")))
(when (file-readable-p project-file)
(org-babel-load-file (expand-file-name project-file)))
)
(provide 'init)