💥 revise hook/var fns naming convention (2/2)
This is second of three big naming convention changes. In this commit, we change the naming conventions for hook functions and variable functions: 1. Replace the bar | to indicate a hook function with a -h suffix, e.g. doom|init-ui -> doom-init-ui-h doom|run-local-var-hooks -> doom-run-local-var-hooks-h 2. And add a -fn suffix for functions meant to be set on variables, e.g. (setq magit-display-buffer-function #'+magit-display-buffer-fn) See ccf327f8 for the reasoning behind these changes.
This commit is contained in:
parent
51d3b1b424
commit
149b2617b0
58 changed files with 521 additions and 517 deletions
14
init.el
14
init.el
|
@ -37,7 +37,7 @@ decrease this. If you experience stuttering, increase this.")
|
|||
|
||||
(defvar doom--file-name-handler-alist file-name-handler-alist)
|
||||
|
||||
(defun doom|restore-startup-optimizations ()
|
||||
(defun doom-restore-startup-optimizations-h ()
|
||||
"Resets garbage collection settings to reasonable defaults (a large
|
||||
`gc-cons-threshold' can cause random freezes otherwise) and resets
|
||||
`file-name-handler-alist'."
|
||||
|
@ -50,14 +50,14 @@ decrease this. If you experience stuttering, increase this.")
|
|||
(setq-default gc-cons-threshold doom-gc-cons-threshold)
|
||||
;; To speed up minibuffer commands (like helm and ivy), we defer garbage
|
||||
;; collection while the minibuffer is active.
|
||||
(defun doom|defer-garbage-collection ()
|
||||
(defun doom-defer-garbage-collection-h ()
|
||||
(setq gc-cons-threshold doom-gc-cons-upper-limit))
|
||||
(defun doom|restore-garbage-collection ()
|
||||
(defun doom-restore-garbage-collection-h ()
|
||||
;; Defer it so that commands launched from the minibuffer can enjoy the
|
||||
;; benefits.
|
||||
(run-at-time 1 nil (lambda () (setq gc-cons-threshold doom-gc-cons-threshold))))
|
||||
(add-hook 'minibuffer-setup-hook #'doom|defer-garbage-collection)
|
||||
(add-hook 'minibuffer-exit-hook #'doom|restore-garbage-collection)
|
||||
(add-hook 'minibuffer-setup-hook #'doom-defer-garbage-collection-h)
|
||||
(add-hook 'minibuffer-exit-hook #'doom-restore-garbage-collection-h)
|
||||
;; GC all sneaky breeky like
|
||||
(add-hook 'focus-out-hook #'garbage-collect))))
|
||||
|
||||
|
@ -66,13 +66,13 @@ decrease this. If you experience stuttering, increase this.")
|
|||
(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'.
|
||||
;; `doom-restore-startup-optimizations-h'.
|
||||
(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))
|
||||
(add-hook 'after-init-hook #'doom-restore-startup-optimizations-h))
|
||||
|
||||
|
||||
;; Ensure Doom is running out of this file's directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue