Add emacs config

This commit is contained in:
2025-05-21 23:32:37 -04:00
parent 23e6ec8ea2
commit 238a9f4fc1
4 changed files with 614 additions and 2 deletions

59
home/emacs/early-init.el Normal file
View File

@@ -0,0 +1,59 @@
;;; 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 & 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 '(("." . "~/.emacs.d/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
(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