Files
nix-config/home/emacs/early-init.el

64 lines
1.7 KiB
EmacsLisp

;;; early-init.el --- early init configuration by chase. -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;; temporarily increase garbage collection threshold
(setq gc-cons-threshold most-positive-fixnum
gc-cons-percentage 0.6)
;; temporarily clear file-name-handler-alist to speed up init
(defvar old-file-name-handler file-name-handler-alist)
(setq file-name-handler-alist nil)
;; temporarily clear vc-handled-backends to speed up init
(defvar old-vc-handled-backends vc-handled-backends)
(setq vc-handled-backends nil)
;; reset file-name-handler and garbage collection after init
(add-hook 'after-init-hook (lambda ()
(setq file-name-handler-alist old-file-name-handler
vc-handled-backends old-vc-handled-backends
gc-cons-threshold 16777216 ; 16mb
gc-cons-percentage 0.1)))
;; avoid loading old byte code
(setq load-prefer-newer t)
;; load path
;; (add-to-list 'load-path "~/.emacs.d/work/")
;; set emacs directory
(setq user-emacs-directory "~/.config/emacs")
;; set & load custom file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
;; backup directory instead of loose files
(setq backup-directory-alist '(("." . "~/.config/emacs/backups")))
(setq backup-by-copying t)
;; defer package initialize
(setq package-enable-at-startup nil)
;; prevent resizing of the frame
(setq frame-inhibit-implied-resize t)
;; no bars when graphical
(when (display-graphic-p)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1))
;; no startup screen
(setq inhibit-startup-screen t)
;; wrapping up
(provide 'early-init)
;;; early-init.el ends here