From f90a75154ec1702160887574af33aba96f07f110 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Tue, 6 Jun 2023 10:32:53 +0200 Subject: [PATCH] refactor: clean up init.el to only contain bare-minimum --- init.el | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/init.el b/init.el index d06699f..444b5ab 100644 --- a/init.el +++ b/init.el @@ -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)