From afe41b1d10c2722de1744097a0f2a4ace3ec1d12 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:52:20 -0400 Subject: [PATCH] First version of the init files --- early-init.el | 45 +++++++++++++++++++++++++++++++++++++++ init.el | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 early-init.el create mode 100644 init.el diff --git a/early-init.el b/early-init.el new file mode 100644 index 0000000..049b49c --- /dev/null +++ b/early-init.el @@ -0,0 +1,45 @@ +;;; early-init.el --- Early Init -*- no-byte-compile: t; lexical-binding: t; -*- + +;; Author: James Cherti +;; URL: https://github.com/jamescherti/minimal-emacs.d +;; Package-Requires: ((emacs "29.1")) +;; Keywords: maint +;; Version: 1 +;; SPDX-License-Identifier: GPL-3.0-or-later + +;;; Commentary: +;; This file contains early initialization settings for Emacs. It is designed +;; to optimize the startup process and configure essential settings before the +;; main initialization. + +;;; Code: + +;; Garbage collection significantly affects startup times. This setting delays +;; garbage collection during startup but will be reset later. +(setq gc-cons-threshold most-positive-fixnum) +(add-hook 'emacs-startup-hook (lambda () + (setq gc-cons-threshold (* 16 1024 1024)))) + +;; Prefer loading newer compiled files +(setq load-prefer-newer t) + +;; Disable startup screens and messages +(setq inhibit-startup-screen t) +(setq initial-scratch-message nil) +(setq inhibit-splash-screen t) + +;; Disable unneeded UI elements +(when (fboundp 'tooltip-mode) + (tooltip-mode -1)) +(unless (memq window-system '(mac ns)) + (menu-bar-mode -1)) +(when (fboundp 'tool-bar-mode) + (tool-bar-mode -1)) +(when (fboundp 'scroll-bar-mode) + (scroll-bar-mode -1)) +(when (fboundp 'horizontal-scroll-bar-mode) + (horizontal-scroll-bar-mode -1)) + +(provide 'early-init) + +;;; early-init.el ends here diff --git a/init.el b/init.el new file mode 100644 index 0000000..3ab623a --- /dev/null +++ b/init.el @@ -0,0 +1,59 @@ +;;; init.el --- Init -*- no-byte-compile: t; lexical-binding: t; -*- + +;; Author: James Cherti +;; URL: https://github.com/jamescherti/minimal-emacs.d +;; Package-Requires: ((emacs "29.1")) +;; Keywords: maint +;; Version: 1 +;; SPDX-License-Identifier: GPL-3.0-or-later + +;;; Commentary: +;; This is the main initialization file for Emacs. It configures package +;; archives, ensures essential packages like `use-package` are installed, and +;; sets up further package management and customization settings. + +;;; Code: + +;;; package: Set package archives for package installation +(progn + (setq package-enable-at-startup nil) + (setq package-quickstart nil) + + (when (version< emacs-version "28") + (add-to-list 'package-archives + '("nongnu" . "https://elpa.nongnu.org/nongnu/"))) + (add-to-list 'package-archives + '("stable" . "https://stable.melpa.org/packages/")) + (add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) + + (customize-set-variable 'package-archive-priorities + '(("gnu" . 99) + ("nongnu" . 80) + ("stable" . 70) + ("melpa" . 0))) + (when package-enable-at-startup + (package-initialize))) + +;;; use-package: +(progn + ;; Always ensure packages are installed + (setq use-package-always-ensure t) + + ;; Ensure the 'use-package' package is installed + (unless (package-installed-p 'use-package) + (package-install 'use-package)) + + ;; Load use-package for package configuration + (eval-when-compile + (require 'use-package))) + +;;; Load user-init.el +(let ((user-init-file (expand-file-name "user-init.el" + user-emacs-directory))) + (when (file-exists-p user-init-file) + (load user-init-file))) + +(provide 'init) + +;;; init.el ends here