aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/early-init.el
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2020-04-21 13:22:55 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2020-04-21 13:22:55 +0200
commitee0d9fc3821f307739433218b70b92363a5fb3f1 (patch)
tree008259c242be8e6c925aa4b34c5c302355cb5e66 /.emacs.d/early-init.el
parent3e983c564234eb14bedeb1353d799be0ef8d50b7 (diff)
downloaddotfiles-ee0d9fc3821f307739433218b70b92363a5fb3f1.tar.gz
dotfiles-ee0d9fc3821f307739433218b70b92363a5fb3f1.zip
emacs: added an early-init.el file
This file will be used by GNU Emacs 27 and later and it be loaded way before init.el kicks in. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.emacs.d/early-init.el')
-rw-r--r--.emacs.d/early-init.el60
1 files changed, 60 insertions, 0 deletions
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
new file mode 100644
index 0000000..5c71a0e
--- /dev/null
+++ b/.emacs.d/early-init.el
@@ -0,0 +1,60 @@
+;;; early-init.el --- early initialization -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 Miquel Sabaté Solà <mikisabate@gmail.com>
+;;
+;; Author: Miquel Sabaté Solà <mikisabate@gmail.com>
+;; Version: 0.1
+;; Package-Requires: ((emacs "27.0"))
+;; Keywords: convenience, extensions, files, frames, mail, matching, terminals, tools, vc, wp
+;; URL: https://github.com/mssola/dotfiles
+;;
+;; This file is not part of GNU Emacs.
+;;
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;; early-init.el support was added in GNU Emacs 27.x, and it will be loaded before init.el and
+;; before many other elements which are relevant for GNU Emacs. Thus, we should be very cautious as
+;; to what we put in here.
+
+;;; Code:
+
+(defconst mssola-initial-gc-cons-threshold gc-cons-threshold
+ "Initial value of `gc-cons-threshold' at start-up time.")
+
+(defconst mssola-initial-gc-cons-percentage gc-cons-percentage
+ "Initial value of `gc-cons-percentage' at start-up time.")
+
+;; Completely disable the GC by having a ginormous threshold. Bringing this back to its previous
+;; values will be handled by init.el.
+(setq gc-cons-threshold most-positive-fixnum
+ gc-cons-percentage 0.6)
+
+;; Prevent the glimpse of un-styled Emacs by setting these early. Taken from doom-emacs.
+(add-to-list 'default-frame-alist '(tool-bar-lines . 0))
+(add-to-list 'default-frame-alist '(menu-bar-lines . 0))
+(add-to-list 'default-frame-alist '(vertical-scroll-bars))
+
+;; Package initialization.
+(require 'package)
+
+(setq package-archives '())
+(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
+(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
+(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
+
+
+;;; early-init.el ends here