From 6fab88ea5abb9650285822e703a5faa0f04e675a Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 12 Aug 2020 02:05:19 +0200 Subject: [PATCH] Port emacs init to emacs 27 --- .emacs.d/config.org | 1 - .emacs.d/early-init.el | 42 ++++++++++++++++++++++++++++++++++++++++++ .emacs.d/init.el | 25 +++++++------------------ 3 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 .emacs.d/early-init.el diff --git a/.emacs.d/config.org b/.emacs.d/config.org index d810b78..425c04c 100644 --- a/.emacs.d/config.org +++ b/.emacs.d/config.org @@ -752,7 +752,6 @@ Set file paths for built-in features like: auto-saves, backups, etc. (setq auto-save-file-name-transforms `((".*" ,auto-save-list-file-prefix t))) (setq backup-directory-alist `((".*" . ,(concat dot-cache-dir "/backup/")))) (setq eshell-directory-name (concat dot-cache-dir "/eshell/")) - (setq package-user-dir (concat dot-emacs-dir "/elpa")) (setq tramp-auto-save-directory (concat dot-cache-dir "/tramp-auto-save/")) (setq tramp-backup-directory-alist backup-directory-alist) (setq url-configuration-directory (concat dot-cache-dir "/url/")) diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el new file mode 100644 index 0000000..8e2233c --- /dev/null +++ b/.emacs.d/early-init.el @@ -0,0 +1,42 @@ +;;; early-init.el --- -*- lexical-binding: t; -*- + +;;; Commentary: + +;; Emacs 27 introduces early-init.el, which is run before package and UI +;; initialization happens. + +;;; Code: + +;; Defer the garbage collection during startup +(setq gc-cons-threshold most-positive-fixnum) +(add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold 8000000))) + +;; ------------------------------------- + +;; Base directory +(setq user-emacs-directory (file-name-directory load-file-name)) + +;; ------------------------------------- + +;; Set package install location +(setq package-user-dir (concat user-emacs-directory "elpa")) + +;; Set package quickstart location +(setq package-quickstart-file (concat + (getenv "XDG_CACHE_HOME") + "/emacs/package-quickstart.el")) + +;; Precompute activation actions to speed up startup +(setq package-quickstart t) + +;; ------------------------------------- + +;; Disable frame bars before they're loaded in +(push '(menu-bar-lines . 0) default-frame-alist) +(push '(tool-bar-lines . 0) default-frame-alist) +(push '(vertical-scroll-bars) default-frame-alist) + +;; Do not resize the frame +(setq frame-inhibit-implied-resize t) + +;;; early-init.el ends here diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 324c7f0..e5393ab 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,35 +1,24 @@ -;;; init.el --- Emacs init file +;;; init.el --- -*- lexical-binding: t; -*- ;;; Commentary: -;; Setup package manager and build configuration file. +;; Setup package archives and build configuration file. ;;; Code: -;; Increases garbage collection during startup -(setq gc-cons-threshold most-positive-fixnum) -(add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold 8000000))) - -; -------------------------------------- - -;; Add the melpa repository to the package manager (require 'package) -(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) -;; Activate autoloads -(package-initialize) +;; Add the MELPA repository to the package manager +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) -;; Install the 'use-package' dependency +;; Install the `use-package' dependency (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) -; -------------------------------------- - -;; Base directory -(setq user-emacs-directory (file-name-directory load-file-name)) +;; ------------------------------------- -;; Tangle configuration file +;; Tangle and load configuration file (require 'org) (when (file-readable-p (concat user-emacs-directory "config.org")) (org-babel-load-file (concat user-emacs-directory "config.org")))