Browse Source

Port emacs init to emacs 27

master
Riyyi 4 years ago
parent
commit
6fab88ea5a
  1. 1
      .emacs.d/config.org
  2. 42
      .emacs.d/early-init.el
  3. 25
      .emacs.d/init.el

1
.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/"))

42
.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

25
.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")))

Loading…
Cancel
Save