diff options
| -rw-r--r-- | .emacs.d/custom.el | 2 | ||||
| -rw-r--r-- | .emacs.d/early-init.el | 60 | ||||
| -rw-r--r-- | .emacs.d/init.org | 42 |
3 files changed, 83 insertions, 21 deletions
diff --git a/.emacs.d/custom.el b/.emacs.d/custom.el index ce2962d..53e00bd 100644 --- a/.emacs.d/custom.el +++ b/.emacs.d/custom.el @@ -13,7 +13,7 @@ '(magit-log-arguments '("--graph" "--color" "--decorate" "-n256")) '(markdown-command "/usr/bin/markdown-calibre") '(package-selected-packages - '(js-mode let-alist doom-modeline evil-collection highlight-numbers langtool clang-format+ keycast gif-screencast py-autopep8 elpy inf-ruby move-text git-timemachine debbugs async-await request emojify auctex diminish bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck evil-surround evil-org evil-numbers evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag))) + '(all-the-icons js-mode let-alist doom-modeline evil-collection highlight-numbers langtool clang-format+ keycast gif-screencast py-autopep8 elpy inf-ruby move-text git-timemachine debbugs async-await request emojify auctex diminish bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck evil-surround evil-org evil-numbers evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. 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 diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 2612c9e..db15e23 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -44,7 +44,7 @@ git update-index --assume-unchanged emacs/init.el From now on our code will be tangled, meaning that it will go into the final =init.el= file. For starters, let's have a good header: #+BEGIN_SRC elisp -;;; init.el -*- lexical-binding: t; -*- +;;; init.el --- init file -*- lexical-binding: t; -*- ;; ;; Copyright (C) 2016-2020 Miquel Sabaté Solà <mikisabate@gmail.com> ;; @@ -135,21 +135,23 @@ Check the operating system: (error "This configuration has been checked only on GNU/Linux and MacOS")) #+END_SRC -Temporarily reduce garbage collection so startup time is lower. Idea taken from -[[https://github.com/purcell][@purcell]]. +Temporarily reduce garbage collection so startup time is lower. Idea taken from [[https://github.com/purcell][@purcell]] and later refined by looking at [[https://github.com/hlissner/doom-emacs][doom-emacs]]. Note that this is handled in the =early-init.el= file for GNU Emacs 27 and later: #+BEGIN_SRC elisp -(defconst mssola-initial-gc-cons-threshold gc-cons-threshold - "Initial value of `gc-cons-threshold' at start-up time.") +(unless EMACS-27-OR-LATER + (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.") + (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. -(setq gc-cons-threshold most-positive-fixnum - gc-cons-percentage 0.6) + ;; Completely disable the GC by having a ginormous threshold. + (setq gc-cons-threshold most-positive-fixnum + gc-cons-percentage 0.6)) -;; Enable the GC back again to its +;; Enable the GC back again to its previous values. This should also be set here +;; for GNU Emacs 27 and later because the early-init.el purposely does not +;; fiddle with this hook. (add-hook 'after-init-hook (lambda () (setq gc-cons-threshold mssola-initial-gc-cons-threshold @@ -180,18 +182,18 @@ Compile the =g.el= script and bind it to @@html:<kbd>M-g</kbd>@@. Initialize package. #+BEGIN_SRC elisp -(require 'package) +;; In GNU Emacs 27 and later this is handled through the early-init.el file. +(unless EMACS-27-OR-LATER + (require 'package) -(when (version= "26.2" emacs-version) - (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) + (when (version= "26.2" emacs-version) + (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) -(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 + '("melpa" . "http://melpa.milkbox.net/packages/") t) + (add-to-list 'package-archives + '("melpa-stable" . "https://stable.melpa.org/packages/") t) -;; This is no longer needed as of GNU Emacs 27.x. -(unless EMACS-27-OR-LATER (package-initialize)) #+END_SRC |
