Refactor core.el

+ Always reset gc-cons-* vars on doom|finalize
+ display-warning => lwarn
This commit is contained in:
Henrik Lissner 2017-06-28 01:12:24 +02:00
parent a894f3ee1e
commit f8dde296ca
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -141,10 +141,9 @@ ability to invoke the debugger in debug mode."
(condition-case-unless-debug ex (condition-case-unless-debug ex
(funcall fn) (funcall fn)
('error ('error
(display-warning (lwarn hook :error
hook "%s in '%s' -> %s"
(format "%s in '%s' -> %s" (car ex) fn (error-message-string ex)) (car ex) fn (error-message-string ex))))
:error)))
nil) nil)
;; Automatic minor modes ;; Automatic minor modes
@ -192,16 +191,17 @@ enable multiple minor modes for the same regexp.")
doom--package-load-path (eval-when-compile doom--package-load-path)) doom--package-load-path (eval-when-compile doom--package-load-path))
(defun doom|finalize () (defun doom|finalize ()
;; Don't keep gc-cons-threshold too high. It helps to stave off the GC while
;; Emacs starts up, but afterwards it causes stuttering and random freezes. So
;; reset it to a reasonable default.
(setq gc-cons-threshold 16777216
gc-cons-percentage 0.1)
(unless doom-init-p (unless doom-init-p
(dolist (hook '(doom-init-hook doom-post-init-hook)) (dolist (hook '(doom-init-hook doom-post-init-hook))
(run-hook-wrapped hook #'doom-try-run-hook hook)) (run-hook-wrapped hook #'doom-try-run-hook hook))
;; Don't keep gc-cons-threshold too high. It helps to stave off the GC while (setq file-name-handler-alist doom--file-name-handler-alist
;; Emacs starts up, but afterwards it causes stuttering and random freezes.
;; So reset it to a reasonable default.
(setq gc-cons-threshold 16777216
gc-cons-percentage 0.1
file-name-handler-alist doom--file-name-handler-alist
doom-init-p t))) doom-init-p t)))
(add-hook! '(emacs-startup-hook doom-reload-hook) (add-hook! '(emacs-startup-hook doom-reload-hook)