Fixes an issue where tramp file handlers were overwritten because they were added to file-name-handler-alist at the end of after-init-hook.
73 lines
3.7 KiB
EmacsLisp
73 lines
3.7 KiB
EmacsLisp
;;; init.el -*- lexical-binding: t; -*-
|
|
;;
|
|
;; Author: Henrik Lissner <henrik@lissner.net>
|
|
;; URL: https://github.com/hlissner/doom-emacs
|
|
;;
|
|
;; ================= =============== =============== ======== ========
|
|
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
|
|
;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
|
|
;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
|
|
;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
|
|
;; || . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||
|
|
;; ||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||
|
|
;; || . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||
|
|
;; ||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||
|
|
;; || ||_-' || || `-_|| || || ||_-' || || | \ / | `||
|
|
;; || `' || || `' || || `' || || | \ / | ||
|
|
;; || .===' `===. .==='.`===. .===' /==. | \/ | ||
|
|
;; || .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||
|
|
;; || .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||
|
|
;; || .==' _-' '-__\._-' '-_./__-' `' |. /| | ||
|
|
;; ||.==' _-' `' | /==.||
|
|
;; ==' _-' \/ `==
|
|
;; \ _-' `-_ /
|
|
;; `'' ``'
|
|
;;
|
|
;; These demons are not part of GNU Emacs.
|
|
;;
|
|
;;; License: MIT
|
|
|
|
(defvar doom-gc-cons-threshold 16777216 ; 16mb
|
|
"The default value to use for `gc-cons-threshold'. If you experience freezing,
|
|
decrease this. If you experience stuttering, increase this.")
|
|
|
|
(defvar doom-gc-cons-upper-limit 268435456 ; 256mb
|
|
"The temporary value for `gc-cons-threshold' to defer it.")
|
|
|
|
|
|
(defvar doom--file-name-handler-alist file-name-handler-alist)
|
|
|
|
(defun doom|restore-startup-optimizations ()
|
|
"Resets garbage collection settings to reasonable defaults (a large
|
|
`gc-cons-threshold' can cause random freezes otherwise) and resets
|
|
`file-name-handler-alist'."
|
|
(setq file-name-handler-alist doom--file-name-handler-alist)
|
|
;; Do this on idle timer to defer a possible GC pause that could result; also
|
|
;; allows deferred packages to take advantage of these optimizations.
|
|
(run-with-idle-timer
|
|
3 nil (lambda () (setq-default gc-cons-threshold doom-gc-cons-threshold))))
|
|
|
|
|
|
(if (or after-init-time noninteractive)
|
|
(setq gc-cons-threshold doom-gc-cons-threshold)
|
|
;; A big contributor to startup times is garbage collection. We up the gc
|
|
;; threshold to temporarily prevent it from running, then reset it later in
|
|
;; `doom|restore-startup-optimizations'.
|
|
(setq gc-cons-threshold doom-gc-cons-upper-limit)
|
|
;; This is consulted on every `require', `load' and various path/io functions.
|
|
;; You get a minor speed up by nooping this.
|
|
(setq file-name-handler-alist nil)
|
|
;; Not restoring these to their defaults will cause stuttering/freezes.
|
|
(add-hook 'after-init-hook #'doom|restore-startup-optimizations))
|
|
|
|
|
|
;; Ensure Doom is running out of this file's directory
|
|
(setq user-emacs-directory (file-name-directory load-file-name))
|
|
;; In noninteractive sessions, prioritize non-byte-compiled source files to
|
|
;; prevent stale, byte-compiled code from running. However, if you're getting
|
|
;; recursive load errors, it may help to set this to nil.
|
|
(setq load-prefer-newer noninteractive)
|
|
|
|
|
|
;; Let 'er rip!
|
|
(require 'core (concat user-emacs-directory "core/core"))
|