💥 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
|
@ -250,7 +250,7 @@ regex PATTERN. Returns the number of killed buffers."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|mark-buffer-as-real ()
|
||||
(defun doom-mark-buffer-as-real-h ()
|
||||
"Hook function that marks the current buffer as real."
|
||||
(doom-set-buffer-real (current-buffer) t))
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ to persist across Emacs sessions.")
|
|||
name under `pcache-directory' (by default a subdirectory under
|
||||
`doom-cache-dir'). One file may contain multiple cache entries.")
|
||||
|
||||
(defun doom|save-persistent-cache ()
|
||||
(defun doom-save-persistent-cache-h ()
|
||||
"Hook to run when an Emacs session is killed. Saves all persisted variables
|
||||
listed in `doom-cache-alists' to files."
|
||||
(dolist (alist (butlast doom-cache-alists 1))
|
||||
|
@ -29,7 +29,7 @@ listed in `doom-cache-alists' to files."
|
|||
for var in (cdr alist)
|
||||
if (symbol-value var)
|
||||
do (doom-cache-set var it nil key))))
|
||||
(add-hook 'kill-emacs-hook #'doom|save-persistent-cache)
|
||||
(add-hook 'kill-emacs-hook #'doom-save-persistent-cache-h)
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
;;; core/autoload/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defvar doom-reload-hook nil
|
||||
"A list of hooks to run when `doom/reload' is called.")
|
||||
|
||||
;;;###autoload
|
||||
(defvar doom-reloading-p nil
|
||||
"TODO")
|
||||
|
@ -72,16 +76,6 @@ Uses the same mechanism as 'bin/doom env reload'."
|
|||
(error "Failed to generate env file"))
|
||||
(doom-load-env-vars doom-env-file))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/reload-font ()
|
||||
"Reload your fonts, if they're set.
|
||||
See `doom|init-fonts'."
|
||||
(interactive)
|
||||
(when doom-font
|
||||
(set-frame-font doom-font t))
|
||||
(doom|init-fonts)
|
||||
(mapc #'doom|init-emoji-fonts (frame-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/reload-theme ()
|
||||
"Reload the current color theme."
|
||||
|
@ -92,4 +86,4 @@ See `doom|init-fonts'."
|
|||
(when (and doom-theme (not (memq doom-theme custom-enabled-themes)))
|
||||
(let (doom--prefer-theme-elc)
|
||||
(load-theme doom-theme t)))
|
||||
(doom|init-fonts)))
|
||||
(doom-init-fonts-h)))
|
||||
|
|
|
@ -169,12 +169,12 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
|
|||
(load! "config" (plist-get plist :path) t)))
|
||||
doom-modules)
|
||||
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)
|
||||
(doom|run-all-startup-hooks)))
|
||||
(doom-run-all-startup-hooks-h)))
|
||||
(`vanilla-doom ; only Doom core
|
||||
`((setq doom-private-dir "/tmp/does/not/exist"
|
||||
doom-init-modules-p t)
|
||||
(load-file ,user-init-file)
|
||||
(doom|run-all-startup-hooks)))
|
||||
(doom-run-all-startup-hooks-h)))
|
||||
(`vanilla ; nothing loaded
|
||||
`((package-initialize)))))))
|
||||
"\n(unwind-protect (progn\n" contents "\n)\n"
|
||||
|
@ -357,7 +357,7 @@ If INIT-FILE is non-nil, profile that instead of USER-INIT-FILE."
|
|||
init-file
|
||||
esup-server-port
|
||||
esup-depth)
|
||||
"--eval=(doom|run-all-startup-hooks)"))))
|
||||
"--eval=(doom-run-all-startup-hooks-h)"))))
|
||||
(when esup-run-as-batch-p
|
||||
(setq process-args (append process-args '("--batch"))))
|
||||
(setq esup-child-process (apply #'start-process process-args)))
|
||||
|
|
|
@ -65,6 +65,15 @@ FRAME parameter defaults to current frame."
|
|||
;;
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/reload-font ()
|
||||
"Reload your fonts, if they're set.
|
||||
See `doom-init-fonts-h'."
|
||||
(interactive)
|
||||
(when doom-font
|
||||
(set-frame-font doom-font t))
|
||||
(mapc #'doom-init-emoji-fonts-h (frame-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/increase-font-size (count)
|
||||
"Enlargens the font size across the current frame."
|
||||
|
|
|
@ -54,7 +54,7 @@ following:
|
|||
(when (and (eq major-mode 'fundamental-mode)
|
||||
(functionp mode))
|
||||
(funcall mode))
|
||||
(add-hook 'kill-buffer-hook #'doom|persist-scratch-buffer nil 'local)
|
||||
(add-hook 'kill-buffer-hook #'doom-persist-scratch-buffer-h nil 'local)
|
||||
(run-hooks 'doom-scratch-buffer-created-hook))
|
||||
buffer)))
|
||||
|
||||
|
@ -63,7 +63,7 @@ following:
|
|||
;;; Persistent scratch buffer
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|persist-scratch-buffer ()
|
||||
(defun doom-persist-scratch-buffer-h ()
|
||||
"Save the current buffer to `doom-scratch-dir'."
|
||||
(write-region
|
||||
(point-min) (point-max)
|
||||
|
@ -71,16 +71,16 @@ following:
|
|||
doom-scratch-dir)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|persist-scratch-buffers ()
|
||||
(defun doom-persist-scratch-buffers-h ()
|
||||
"Save all scratch buffers to `doom-scratch-dir'."
|
||||
(setq doom-scratch-buffers (cl-delete-if-not #'buffer-live-p doom-scratch-buffers))
|
||||
(dolist (buffer doom-scratch-buffers)
|
||||
(with-current-buffer buffer
|
||||
(doom|persist-scratch-buffer))))
|
||||
(doom-persist-scratch-buffer-h))))
|
||||
|
||||
;;;###autoload
|
||||
(unless noninteractive
|
||||
(add-hook 'kill-emacs-hook #'doom|persist-scratch-buffers))
|
||||
(add-hook 'kill-emacs-hook #'doom-persist-scratch-buffers-h))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -211,25 +211,25 @@ Respects `require-final-newline'."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|enable-delete-trailing-whitespace ()
|
||||
(defun doom-enable-delete-trailing-whitespace-h ()
|
||||
"Enables the automatic deletion of trailing whitespaces upon file save.
|
||||
|
||||
i.e. enables `ws-butler-mode' in the current buffer."
|
||||
(ws-butler-mode +1))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|disable-delete-trailing-whitespace ()
|
||||
(defun doom-disable-delete-trailing-whitespace-h ()
|
||||
"Disables the automatic deletion of trailing whitespaces upon file save.
|
||||
|
||||
i.e. disables `ws-butler-mode' in the current buffer."
|
||||
(ws-butler-mode -1))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|enable-show-trailing-whitespace ()
|
||||
(defun doom-enable-show-trailing-whitespace-h ()
|
||||
"Enable `show-trailing-whitespace' in the current buffer."
|
||||
(setq-local show-trailing-whitespace t))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|disable-show-trailing-whitespace ()
|
||||
(defun doom-disable-show-trailing-whitespace-h ()
|
||||
"Disable `show-trailing-whitespace' in the current buffer."
|
||||
(setq-local show-trailing-whitespace nil))
|
||||
|
|
|
@ -41,14 +41,14 @@ are open."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|apply-ansi-color-to-compilation-buffer ()
|
||||
(defun doom-apply-ansi-color-to-compilation-buffer-h ()
|
||||
"Applies ansi codes to the compilation buffers. Meant for
|
||||
`compilation-filter-hook'."
|
||||
(with-silent-modifications
|
||||
(ansi-color-apply-on-region compilation-filter-start (point))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|disable-show-paren-mode ()
|
||||
(defun doom-disable-show-paren-mode-h ()
|
||||
"Turn off `show-paren-mode' buffer-locally."
|
||||
(setq-local show-paren-mode nil))
|
||||
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
;;; core-editor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar doom-large-file-size 2
|
||||
"Size (in MB) above which the user will be prompted to open the file literally
|
||||
to avoid performance issues. Opening literally means that no major or minor
|
||||
modes are active and the buffer is read-only.")
|
||||
|
||||
(defvar doom-large-file-modes-list
|
||||
'(fundamental-mode special-mode archive-mode tar-mode jka-compr
|
||||
git-commit-mode image-mode doc-view-mode doc-view-mode-maybe
|
||||
ebrowse-tree-mode pdf-view-mode tags-table-mode)
|
||||
"Major modes that `doom|check-large-file' will ignore.")
|
||||
|
||||
(defvar-local doom-inhibit-indent-detection nil
|
||||
"A buffer-local flag that indicates whether `dtrt-indent' should try to detect
|
||||
indentation settings or not. This should be set by editorconfig if it
|
||||
|
@ -74,10 +63,10 @@ detected.")
|
|||
|
||||
(def-package! autorevert
|
||||
;; revert buffers when their files/state have changed
|
||||
:hook (focus-in . doom|auto-revert-buffers)
|
||||
:hook (after-save . doom|auto-revert-buffers)
|
||||
:hook (doom-switch-buffer . doom|auto-revert-buffer)
|
||||
:hook (doom-switch-window . doom|auto-revert-buffer)
|
||||
:hook (focus-in . doom-auto-revert-buffers-h)
|
||||
:hook (after-save . doom-auto-revert-buffers-h)
|
||||
:hook (doom-switch-buffer . doom-auto-revert-buffer-h)
|
||||
:hook (doom-switch-window . doom-auto-revert-buffer-h)
|
||||
:config
|
||||
(setq auto-revert-verbose t ; let us know when it happens
|
||||
auto-revert-use-notify nil
|
||||
|
@ -90,17 +79,19 @@ detected.")
|
|||
;; grind Emacs to a halt if you do expensive IO (outside of Emacs) on the
|
||||
;; files you have open (like compression). We only really need revert changes
|
||||
;; when we switch to a buffer or when we focus the Emacs frame.
|
||||
(defun doom|auto-revert-buffers ()
|
||||
(defun doom-auto-revert-buffer-h ()
|
||||
"Auto revert current buffer, if necessary."
|
||||
(unless auto-revert-mode
|
||||
(let ((revert-without-query t))
|
||||
(auto-revert-handler))))
|
||||
|
||||
(defun doom-auto-revert-buffers-h ()
|
||||
"Auto revert's stale buffers (that are visible)."
|
||||
(unless auto-revert-mode
|
||||
(dolist (buf (doom-visible-buffers))
|
||||
(with-current-buffer buf
|
||||
(auto-revert-handler)))))
|
||||
(doom-auto-revert-buffer-h))))))
|
||||
|
||||
(defun doom|auto-revert-buffer ()
|
||||
"Auto revert current buffer, if necessary."
|
||||
(unless auto-revert-mode
|
||||
(auto-revert-handler))))
|
||||
|
||||
(def-package! recentf
|
||||
;; Keep track of recently opened files
|
||||
|
@ -126,19 +117,18 @@ detected.")
|
|||
file))
|
||||
(setq recentf-filename-handlers '(doom--recent-file-truename abbreviate-file-name))
|
||||
|
||||
(defun doom|recentf-touch-buffer ()
|
||||
"Bump file in recent file list when it is switched or written to."
|
||||
(when buffer-file-name
|
||||
(recentf-add-file buffer-file-name))
|
||||
;; Return nil for `write-file-functions'
|
||||
nil)
|
||||
(add-hook 'doom-switch-window-hook #'doom|recentf-touch-buffer)
|
||||
(add-hook 'write-file-functions #'doom|recentf-touch-buffer)
|
||||
(add-hook! '(doom-switch-window-hook write-file-functions)
|
||||
(defun doom--recentf-touch-buffer-h ()
|
||||
"Bump file in recent file list when it is switched or written to."
|
||||
(when buffer-file-name
|
||||
(recentf-add-file buffer-file-name))
|
||||
;; Return nil for `write-file-functions'
|
||||
nil))
|
||||
|
||||
(defun doom|recentf-add-dired-directory ()
|
||||
"Add dired directory to recentf file list."
|
||||
(recentf-add-file default-directory))
|
||||
(add-hook 'dired-mode-hook #'doom|recentf-add-dired-directory)
|
||||
(add-hook 'dired-mode-hook
|
||||
(defun doom--recentf-add-dired-directory-h ()
|
||||
"Add dired directory to recentf file list."
|
||||
(recentf-add-file default-directory)))
|
||||
|
||||
(unless noninteractive
|
||||
(add-hook 'kill-emacs-hook #'recentf-cleanup)
|
||||
|
@ -155,14 +145,14 @@ detected.")
|
|||
savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
|
||||
(savehist-mode +1)
|
||||
|
||||
(defun doom|unpropertize-kill-ring ()
|
||||
"Remove text properties from `kill-ring' in the interest of shrinking the
|
||||
savehist file."
|
||||
(setq kill-ring (cl-loop for item in kill-ring
|
||||
if (stringp item)
|
||||
collect (substring-no-properties item)
|
||||
else if item collect it)))
|
||||
(add-hook 'kill-emacs-hook #'doom|unpropertize-kill-ring))
|
||||
(add-hook 'kill-emacs-hook
|
||||
(defun doom-unpropertize-kill-ring-h ()
|
||||
"Remove text properties from `kill-ring' for a smaller savehist file."
|
||||
(setq kill-ring (cl-loop for item in kill-ring
|
||||
if (stringp item)
|
||||
collect (substring-no-properties item)
|
||||
else if item collect it)))))
|
||||
|
||||
|
||||
(def-package! saveplace
|
||||
;; persistent point location in buffers
|
||||
|
@ -223,7 +213,7 @@ savehist file."
|
|||
origin))))
|
||||
result))
|
||||
|
||||
(defun doom|set-jump ()
|
||||
(defun doom-set-jump-h ()
|
||||
"Run `better-jumper-set-jump' but return nil, for short-circuiting hooks."
|
||||
(better-jumper-set-jump)
|
||||
nil))
|
||||
|
@ -243,16 +233,15 @@ savehist file."
|
|||
:unless noninteractive
|
||||
:defer t
|
||||
:init
|
||||
(defun doom|detect-indentation ()
|
||||
(unless (or (not after-init-time)
|
||||
doom-inhibit-indent-detection
|
||||
(member (substring (buffer-name) 0 1) '(" " "*"))
|
||||
(memq major-mode doom-detect-indentation-excluded-modes))
|
||||
;; Don't display messages in the echo area, but still log them
|
||||
(let ((inhibit-message (not doom-debug-mode)))
|
||||
(dtrt-indent-mode +1))))
|
||||
(add-hook! '(change-major-mode-after-body-hook read-only-mode-hook)
|
||||
#'doom|detect-indentation)
|
||||
(defun doom-detect-indentation-h ()
|
||||
(unless (or (not after-init-time)
|
||||
doom-inhibit-indent-detection
|
||||
(member (substring (buffer-name) 0 1) '(" " "*"))
|
||||
(memq major-mode doom-detect-indentation-excluded-modes))
|
||||
;; Don't display messages in the echo area, but still log them
|
||||
(let ((inhibit-message (not doom-debug-mode)))
|
||||
(dtrt-indent-mode +1)))))
|
||||
:config
|
||||
(setq dtrt-indent-run-after-smie t)
|
||||
|
||||
|
@ -323,12 +312,12 @@ savehist file."
|
|||
sp-escape-quotes-after-insert nil) ; not smart enough
|
||||
|
||||
;; autopairing in `eval-expression' and `evil-ex'
|
||||
(defun doom|init-smartparens-in-eval-expression ()
|
||||
"Enable `smartparens-mode' in the minibuffer, during `eval-expression' or
|
||||
(add-hook 'minibuffer-setup-hook
|
||||
(defun doom--init-smartparens-in-eval-expression-h ()
|
||||
"Enable `smartparens-mode' in the minibuffer, during `eval-expression' or
|
||||
`evil-ex'."
|
||||
(when (memq this-command '(eval-expression evil-ex))
|
||||
(smartparens-mode)))
|
||||
(add-hook 'minibuffer-setup-hook #'doom|init-smartparens-in-eval-expression)
|
||||
(when (memq this-command '(eval-expression evil-ex))
|
||||
(smartparens-mode))))
|
||||
|
||||
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
|
||||
(sp-local-pair 'minibuffer-inactive-mode "`" nil :actions nil)
|
||||
|
|
|
@ -157,20 +157,20 @@ localleader prefix."
|
|||
|
||||
;; Bind `doom-leader-key' and `doom-leader-alt-key' as late as possible to give
|
||||
;; the user a chance to modify them.
|
||||
(defun doom|init-leader-keys ()
|
||||
"Bind `doom-leader-key' and `doom-leader-alt-key'."
|
||||
(let ((map general-override-mode-map))
|
||||
(if (not (featurep 'evil))
|
||||
(progn
|
||||
(cond ((equal doom-leader-alt-key "C-c")
|
||||
(set-keymap-parent doom-leader-map mode-specific-map))
|
||||
((equal doom-leader-alt-key "C-x")
|
||||
(set-keymap-parent doom-leader-map ctl-x-map)))
|
||||
(define-key map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(evil-define-key* '(normal visual motion) map (kbd doom-leader-key) 'doom/leader)
|
||||
(evil-define-key* '(emacs insert) map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(general-override-mode +1)))
|
||||
(add-hook 'doom-after-init-modules-hook #'doom|init-leader-keys)
|
||||
(add-hook 'doom-after-init-modules-hook
|
||||
(defun doom-init-leader-keys-h ()
|
||||
"Bind `doom-leader-key' and `doom-leader-alt-key'."
|
||||
(let ((map general-override-mode-map))
|
||||
(if (not (featurep 'evil))
|
||||
(progn
|
||||
(cond ((equal doom-leader-alt-key "C-c")
|
||||
(set-keymap-parent doom-leader-map mode-specific-map))
|
||||
((equal doom-leader-alt-key "C-x")
|
||||
(set-keymap-parent doom-leader-map ctl-x-map)))
|
||||
(define-key map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(evil-define-key* '(normal visual motion) map (kbd doom-leader-key) 'doom/leader)
|
||||
(evil-define-key* '(emacs insert) map (kbd doom-leader-alt-key) 'doom/leader))
|
||||
(general-override-mode +1))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -176,8 +176,8 @@ advised)."
|
|||
(declare (indent 1))
|
||||
(let ((append (if (eq (car forms) :after) (pop forms)))
|
||||
(fn (if (symbolp (car forms))
|
||||
(intern (format "doom|transient-hook-%s" (pop forms)))
|
||||
(make-symbol "doom|transient-hook"))))
|
||||
(intern (format "doom--transient-%s-h" (pop forms)))
|
||||
(make-symbol "doom--transient-h"))))
|
||||
`(let ((sym ,hook-or-function))
|
||||
(fset ',fn
|
||||
(lambda (&rest _)
|
||||
|
@ -204,8 +204,8 @@ This macro accepts, in order:
|
|||
2. The hook(s) to be added to: either an unquoted mode, an unquoted list of
|
||||
modes, a quoted hook variable or a quoted list of hook variables. If
|
||||
unquoted, '-hook' will be appended to each symbol.
|
||||
3. The function(s) to be added: this can be one function, a list thereof, or
|
||||
body forms (implicitly wrapped in a closure).
|
||||
3. The function(s) to be added: this can be one function, a list thereof, a
|
||||
list of `defun's, or body forms (implicitly wrapped in a closure).
|
||||
|
||||
Examples:
|
||||
(add-hook! 'some-mode-hook 'enable-something) (same as `add-hook')
|
||||
|
@ -226,15 +226,23 @@ Examples:
|
|||
(:append (setq append-p t))
|
||||
(:local (setq local-p t))
|
||||
(:remove (setq hook-fn 'remove-hook))))
|
||||
(let ((hooks (doom--resolve-hook-forms (pop args)))
|
||||
(funcs
|
||||
(let ((val (car args)))
|
||||
(if (memq (car-safe val) '(quote function))
|
||||
(if (cdr-safe (cadr val))
|
||||
(cadr val)
|
||||
(list (cadr val)))
|
||||
(list args))))
|
||||
forms)
|
||||
(let* ((defun-forms nil)
|
||||
(hooks (doom--resolve-hook-forms (pop args)))
|
||||
(funcs
|
||||
(let ((val (car args)))
|
||||
(if (memq (car-safe val) '(quote function))
|
||||
(if (cdr-safe (cadr val))
|
||||
(cadr val)
|
||||
(list (cadr val)))
|
||||
(or (and (eq (car-safe val) 'defun)
|
||||
(cl-loop for arg in args
|
||||
if (not (eq (car-safe arg) 'defun))
|
||||
return nil
|
||||
else
|
||||
collect (cadr arg)
|
||||
and do (push arg defun-forms)))
|
||||
(list args)))))
|
||||
forms)
|
||||
(dolist (fn funcs)
|
||||
(setq fn (if (symbolp fn)
|
||||
`(function ,fn)
|
||||
|
@ -244,7 +252,9 @@ Examples:
|
|||
`(remove-hook ',hook ,fn ,local-p)
|
||||
`(add-hook ',hook ,fn ,append-p ,local-p))
|
||||
forms)))
|
||||
`(progn ,@(if append-p (nreverse forms) forms)))))
|
||||
(macroexp-progn
|
||||
(append (nreverse defun-forms)
|
||||
(if append-p (nreverse forms) forms))))))
|
||||
|
||||
(defmacro remove-hook! (&rest args)
|
||||
"A convenience macro for removing N functions from M hooks.
|
||||
|
@ -277,7 +287,7 @@ If N and M = 1, there's no benefit to using this macro over `remove-hook'.
|
|||
(macroexp-progn
|
||||
(cl-loop for hook in (doom--resolve-hook-forms hooks)
|
||||
for mode = (string-remove-suffix "-hook" (symbol-name hook))
|
||||
for fn = (intern (format "doom|setq-%s-for-%s" vars mode))
|
||||
for fn = (intern (format "doom--setq-%s-for-%s-h" vars mode))
|
||||
collect `(fset ',fn
|
||||
(lambda (&rest _)
|
||||
,@(let (forms)
|
||||
|
@ -330,7 +340,7 @@ The available conditions are:
|
|||
(not (or (listp files)
|
||||
(stringp files))))
|
||||
(user-error "associate! :files expects a string or list of strings"))
|
||||
(let ((hook-name (intern (format "doom--init-mode-%s" mode))))
|
||||
(let ((hook-name (intern (format "doom--enable-mode-%s-h" mode))))
|
||||
`(progn
|
||||
(fset ',hook-name
|
||||
(lambda ()
|
||||
|
@ -414,7 +424,7 @@ all themes. It will apply to all themes once they are loaded.
|
|||
'(org-ellipsis :inherit org-tag)
|
||||
'(which-key-docstring-face :inherit font-lock-comment-face))"
|
||||
`(let* ((themes (doom-enlist (or ,theme 'user)))
|
||||
(fn (gensym (format "doom|customize-%s-" (mapconcat #'symbol-name themes "-")))))
|
||||
(fn (gensym (format "doom--customize-%s-h-" (mapconcat #'symbol-name themes "-")))))
|
||||
(fset fn
|
||||
(lambda ()
|
||||
(dolist (theme themes)
|
||||
|
|
|
@ -275,7 +275,7 @@ If ALL-P is non-nil, return paths of possible modules, activated or otherwise."
|
|||
(defun use-package-handler/:after-call (name _keyword hooks rest state)
|
||||
(if (plist-get state :demand)
|
||||
(use-package-process-keywords name rest state)
|
||||
(let ((fn (make-symbol (format "doom|transient-hook--load-%s" name))))
|
||||
(let ((fn (make-symbol (format "doom--after-call-%s-h" name))))
|
||||
(use-package-concat
|
||||
`((fset ',fn
|
||||
(lambda (&rest _)
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
(unless IS-LINUX (setq command-line-x-option-alist nil))
|
||||
|
||||
;; Fix the clipboard in terminal or daemon Emacs (non-GUI)
|
||||
(defun doom|init-clipboard-in-tty-emacs ()
|
||||
(defun doom-init-clipboard-in-tty-emacs-h ()
|
||||
(if IS-MAC
|
||||
(if (require 'osx-clipboard nil t) (osx-clipboard-mode))
|
||||
(if (require 'xclip nil t) (xclip-mode))))
|
||||
(add-hook 'tty-setup-hook #'doom|init-clipboard-in-tty-emacs)
|
||||
(add-hook 'tty-setup-hook #'doom-init-clipboard-in-tty-emacs-h)
|
||||
|
||||
;; Enable mouse in terminal Emacs
|
||||
(add-hook 'tty-setup-hook #'xterm-mouse-mode)
|
||||
|
|
|
@ -57,29 +57,29 @@ Emacs.")
|
|||
;; projectile's cache (into the hundreds of MBs). This purges those entries
|
||||
;; when exiting Emacs to prevent slowdowns/freezing when cache files are
|
||||
;; loaded or written to.
|
||||
(defun doom|cleanup-project-cache ()
|
||||
"Purge projectile cache entries that:
|
||||
(add-hook 'kill-emacs-hook
|
||||
(defun doom-cleanup-project-cache-h ()
|
||||
"Purge projectile cache entries that:
|
||||
|
||||
a) have too many files (see `doom-projectile-cache-limit'),
|
||||
b) represent blacklisted directories that are too big, change too often or are
|
||||
private. (see `doom-projectile-cache-blacklist'),
|
||||
c) are not valid projectile projects."
|
||||
(when (bound-and-true-p projectile-projects-cache)
|
||||
(cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist)
|
||||
for proot in (hash-table-keys projectile-projects-cache)
|
||||
if (or (not (stringp proot))
|
||||
(>= (length (gethash proot projectile-projects-cache))
|
||||
doom-projectile-cache-limit)
|
||||
(member (substring proot 0 -1) blacklist)
|
||||
(and doom-projectile-cache-purge-non-projects
|
||||
(not (doom-project-p proot))))
|
||||
do (doom-log "Removed %S from projectile cache" proot)
|
||||
and do (remhash proot projectile-projects-cache)
|
||||
and do (remhash proot projectile-projects-cache-time)
|
||||
and do (remhash proot projectile-project-type-cache))
|
||||
(projectile-serialize-cache)))
|
||||
(unless noninteractive
|
||||
(add-hook 'kill-emacs-hook #'doom|cleanup-project-cache))
|
||||
(when (and (bound-and-true-p projectile-projects-cache)
|
||||
(not noninteractive))
|
||||
(cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist)
|
||||
for proot in (hash-table-keys projectile-projects-cache)
|
||||
if (or (not (stringp proot))
|
||||
(>= (length (gethash proot projectile-projects-cache))
|
||||
doom-projectile-cache-limit)
|
||||
(member (substring proot 0 -1) blacklist)
|
||||
(and doom-projectile-cache-purge-non-projects
|
||||
(not (doom-project-p proot))))
|
||||
do (doom-log "Removed %S from projectile cache" proot)
|
||||
and do (remhash proot projectile-projects-cache)
|
||||
and do (remhash proot projectile-projects-cache-time)
|
||||
and do (remhash proot projectile-project-type-cache))
|
||||
(projectile-serialize-cache))))
|
||||
|
||||
;; It breaks projectile's project root resolution if HOME is a project (e.g.
|
||||
;; it's a git repo). In that case, we disable bottom-up root searching to
|
||||
|
|
100
core/core-ui.el
100
core/core-ui.el
|
@ -53,7 +53,7 @@ size.")
|
|||
|
||||
(defvar doom--prefer-theme-elc nil
|
||||
"If non-nil, `load-theme' will prefer the compiled theme (unlike its default
|
||||
behavior). Do not set this directly, this is let-bound in `doom|init-theme'.")
|
||||
behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
|
||||
|
||||
|
||||
;;
|
||||
|
@ -85,8 +85,8 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.")
|
|||
(defvar doom--last-window nil)
|
||||
(defvar doom--last-frame nil)
|
||||
|
||||
(defun doom|run-switch-window-hooks ()
|
||||
(let ((gc-cons-threshold doom-gc-cons-upper-limit))
|
||||
(defun doom-run-switch-window-hooks-h ()
|
||||
(let ((gc-cons-threshold most-positive-fixnum))
|
||||
(unless (or doom-inhibit-switch-window-hooks
|
||||
(eq doom--last-window (selected-window))
|
||||
(minibufferp))
|
||||
|
@ -94,7 +94,7 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.")
|
|||
(run-hooks 'doom-switch-window-hook)
|
||||
(setq doom--last-window (selected-window))))))
|
||||
|
||||
(defun doom|run-switch-frame-hooks (&rest _)
|
||||
(defun doom-run-switch-frame-hooks-h (&rest _)
|
||||
(unless (or doom-inhibit-switch-frame-hooks
|
||||
(eq doom--last-frame (selected-frame))
|
||||
(frame-parameter nil 'parent-frame))
|
||||
|
@ -130,7 +130,7 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.")
|
|||
"Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."
|
||||
(not (eq (current-buffer) (doom-fallback-buffer))))
|
||||
|
||||
(defun doom|highlight-non-default-indentation ()
|
||||
(defun doom-highlight-non-default-indentation-h ()
|
||||
"Highlight whitespace that doesn't match your `indent-tabs-mode' setting.
|
||||
|
||||
e.g. If you indent with spaces by default, tabs will be highlighted. If you
|
||||
|
@ -224,7 +224,7 @@ read-only or not file-visiting."
|
|||
;; Use `show-trailing-whitespace' instead of `whitespace-mode' because it's
|
||||
;; faster (implemented in C). But try to only enable it in editing buffers.
|
||||
(setq-default show-trailing-whitespace nil)
|
||||
(setq-hook! '(prog-mode-hook text-mode-hook conf-mode-hook) show-trailing-whitespace t)
|
||||
(add-hook! (prog-mode text-mode conf-mode) #'doom-enable-show-trailing-whitespace-h)
|
||||
|
||||
;; The native border "consumes" a pixel of the fringe on righter-most splits,
|
||||
;; `window-divider' does not. Available since Emacs 25.1.
|
||||
|
@ -279,23 +279,22 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
:config
|
||||
(defvar doom--ediff-saved-wconf nil)
|
||||
;; Restore window config after quitting ediff
|
||||
(defun doom|ediff-save-wconf ()
|
||||
(setq doom--ediff-saved-wconf (current-window-configuration)))
|
||||
(add-hook 'ediff-before-setup-hook #'doom|ediff-save-wconf)
|
||||
|
||||
(defun doom|ediff-restore-wconf ()
|
||||
(when (window-configuration-p doom--ediff-saved-wconf)
|
||||
(set-window-configuration doom--ediff-saved-wconf)))
|
||||
(add-hook 'ediff-quit-hook #'doom|ediff-restore-wconf 'append)
|
||||
(add-hook 'ediff-suspend-hook #'doom|ediff-restore-wconf 'append))
|
||||
(add-hook 'ediff-before-setup-hook
|
||||
(defun doom--ediff-save-wconf-h ()
|
||||
(setq doom--ediff-saved-wconf (current-window-configuration))))
|
||||
(add-hook! '(ediff-quit-hook ediff-suspend-hook)
|
||||
(defun doom--ediff-restore-wconf-h ()
|
||||
(when (window-configuration-p doom--ediff-saved-wconf)
|
||||
(set-window-configuration doom--ediff-saved-wconf)))
|
||||
'append))
|
||||
|
||||
|
||||
(def-package! hl-line
|
||||
;; Highlights the current line
|
||||
:hook ((prog-mode text-mode conf-mode) . hl-line-mode)
|
||||
:config
|
||||
;; I don't need hl-line showing in other windows. This also offers a small
|
||||
;; speed boost when buffer is displayed in multiple windows.
|
||||
;; PERF Not having to render the hl-line overlay in multiple buffers offers a
|
||||
;; tiny performance boost. I also don't need to see it in other buffers.
|
||||
(setq hl-line-sticky-flag nil
|
||||
global-hl-line-sticky-flag nil)
|
||||
|
||||
|
@ -303,17 +302,15 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;; selection region harder to see while in evil visual mode.
|
||||
(after! evil
|
||||
(defvar doom-buffer-hl-line-mode nil)
|
||||
|
||||
(defun doom|disable-hl-line ()
|
||||
(when hl-line-mode
|
||||
(setq-local doom-buffer-hl-line-mode t)
|
||||
(hl-line-mode -1)))
|
||||
(add-hook 'evil-visual-state-entry-hook #'doom|disable-hl-line)
|
||||
|
||||
(defun doom|enable-hl-line-maybe ()
|
||||
(when doom-buffer-hl-line-mode
|
||||
(hl-line-mode +1)))
|
||||
(add-hook 'evil-visual-state-exit-hook #'doom|enable-hl-line-maybe)))
|
||||
(add-hook 'evil-visual-state-entry-hook
|
||||
(defun doom-disable-hl-line-h ()
|
||||
(when hl-line-mode
|
||||
(setq-local doom-buffer-hl-line-mode t)
|
||||
(hl-line-mode -1))))
|
||||
(add-hook 'evil-visual-state-exit-hook
|
||||
(defun doom-enable-hl-line-maybe-h ()
|
||||
(when doom-buffer-hl-line-mode
|
||||
(hl-line-mode +1))))))
|
||||
|
||||
|
||||
(def-package! winner
|
||||
|
@ -366,8 +363,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
"")))
|
||||
|
||||
;;;###package hide-mode-line-mode
|
||||
(add-hook 'completion-list-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook 'Man-mode-hook #'hide-mode-line-mode)
|
||||
(add-hook! '(completion-list-mode-hook Man-mode-hook)
|
||||
#'hide-mode-line-mode)
|
||||
|
||||
;; Better fontification of number literals in code
|
||||
(def-package! highlight-numbers
|
||||
|
@ -384,10 +381,11 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;;; Line numbers
|
||||
|
||||
;; line numbers in most modes
|
||||
(add-hook! (prog-mode text-mode conf-mode) #'display-line-numbers-mode)
|
||||
(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook)
|
||||
#'display-line-numbers-mode)
|
||||
|
||||
(defun doom|enable-line-numbers () (display-line-numbers-mode +1))
|
||||
(defun doom|disable-line-numbers () (display-line-numbers-mode -1))
|
||||
(defun doom-enable-line-numbers-h () (display-line-numbers-mode +1))
|
||||
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
|
||||
|
||||
;; `nlinum' is used for Emacs 25 users, as Emacs 26+ has native line numbers.
|
||||
(def-package! nlinum
|
||||
|
@ -432,12 +430,12 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
|||
str))
|
||||
(setq nlinum-format-function #'doom-nlinum-format-fn)
|
||||
|
||||
(defun doom|init-nlinum-width ()
|
||||
"Calculate line number column width beforehand (optimization)."
|
||||
(setq nlinum--width
|
||||
(length (save-excursion (goto-char (point-max))
|
||||
(format-mode-line "%l")))))
|
||||
(add-hook 'nlinum-mode-hook #'doom|init-nlinum-width))
|
||||
(add-hook 'nlinum-mode-hook
|
||||
(defun doom--init-nlinum-width-h ()
|
||||
"Calculate line number column width beforehand (optimization)."
|
||||
(setq nlinum--width
|
||||
(length (save-excursion (goto-char (point-max))
|
||||
(format-mode-line "%l")))))))
|
||||
|
||||
(def-package! nlinum-hl
|
||||
;; Fixes disappearing line numbers in nlinum and other quirks
|
||||
|
@ -466,7 +464,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
|||
;;
|
||||
;;; Theme & font
|
||||
|
||||
(defun doom|init-fonts ()
|
||||
(defun doom-init-fonts-h ()
|
||||
"Loads fonts.
|
||||
|
||||
Fonts are specified by `doom-font', `doom-variable-pitch-font',
|
||||
|
@ -493,14 +491,14 @@ Fonts are specified by `doom-font', `doom-variable-pitch-font',
|
|||
(font-get (caddr e) :family))
|
||||
(signal 'doom-error e)))))
|
||||
|
||||
(defun doom|init-emoji-fonts (frame)
|
||||
(defun doom-init-emoji-fonts-h (frame)
|
||||
"Set up unicode fonts (if `doom-unicode-font' is set).
|
||||
|
||||
By default, this uses Apple Color Emoji on MacOS and Symbola on Linux."
|
||||
(when doom-unicode-font
|
||||
(set-fontset-font t 'unicode doom-unicode-font frame 'prepend)))
|
||||
|
||||
(defun doom|init-theme (&optional frame)
|
||||
(defun doom-init-theme-h (&optional frame)
|
||||
"Load the theme specified by `doom-theme' in FRAME."
|
||||
(when (and doom-theme (not (memq doom-theme custom-enabled-themes)))
|
||||
(with-selected-frame (or frame (selected-frame))
|
||||
|
@ -531,19 +529,19 @@ startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil."
|
|||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(defun doom|init-ui ()
|
||||
(defun doom-init-ui-h ()
|
||||
"Initialize Doom's user interface by applying all its advice and hooks."
|
||||
(run-hook-wrapped 'doom-init-ui-hook #'doom-try-run-hook)
|
||||
|
||||
(add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil 'eq)
|
||||
(add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation)
|
||||
(add-to-list 'kill-buffer-query-functions #'doom-protect-fallback-buffer-h nil 'eq)
|
||||
(add-hook 'after-change-major-mode-hook #'doom-highlight-non-default-indentation-h)
|
||||
|
||||
;; Initialize custom switch-{buffer,window,frame} hooks:
|
||||
;; + `doom-switch-buffer-hook'
|
||||
;; + `doom-switch-window-hook'
|
||||
;; + `doom-switch-frame-hook'
|
||||
(add-hook 'buffer-list-update-hook #'doom|run-switch-window-hooks)
|
||||
(add-hook 'focus-in-hook #'doom|run-switch-frame-hooks)
|
||||
(add-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h)
|
||||
(add-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h)
|
||||
(dolist (fn '(switch-to-next-buffer switch-to-prev-buffer))
|
||||
(advice-add fn :around #'doom-run-switch-to-next-prev-buffer-hooks-a))
|
||||
(dolist (fn '(switch-to-buffer display-buffer))
|
||||
|
@ -553,13 +551,13 @@ startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil."
|
|||
(add-hook (if (daemonp)
|
||||
'after-make-frame-functions
|
||||
'doom-init-ui-hook)
|
||||
#'doom|init-theme)
|
||||
#'doom-init-theme-h)
|
||||
;; Apply `doom-font' et co
|
||||
(add-hook 'doom-after-init-modules-hook #'doom|init-fonts)
|
||||
(add-hook 'doom-after-init-modules-hook #'doom-init-fonts-h)
|
||||
;; Ensure unicode fonts are set on each frame
|
||||
(add-hook 'after-make-frame-functions #'doom|init-emoji-fonts)
|
||||
(add-hook 'after-make-frame-functions #'doom-init-emoji-fonts-h)
|
||||
|
||||
(add-hook 'window-setup-hook #'doom|init-ui)
|
||||
(add-hook 'window-setup-hook #'doom-init-ui-h)
|
||||
|
||||
|
||||
;;
|
||||
|
|
72
core/core.el
72
core/core.el
|
@ -231,7 +231,7 @@ original value of `symbol-file'."
|
|||
`auto-mode-alist'. All elements of this alist are checked, meaning you can
|
||||
enable multiple minor modes for the same regexp.")
|
||||
|
||||
(defun doom|enable-minor-mode-maybe ()
|
||||
(defun doom-enable-minor-mode-maybe-h ()
|
||||
"Check file name against `doom-auto-minor-mode-alist'."
|
||||
(when (and buffer-file-name doom-auto-minor-mode-alist)
|
||||
(let ((name buffer-file-name)
|
||||
|
@ -247,7 +247,7 @@ enable multiple minor modes for the same regexp.")
|
|||
(if (string-match-p (caar alist) name)
|
||||
(funcall (cdar alist) 1))
|
||||
(setq alist (cdr alist))))))
|
||||
(add-hook 'find-file-hook #'doom|enable-minor-mode-maybe)
|
||||
(add-hook 'find-file-hook #'doom-enable-minor-mode-maybe-h)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -256,27 +256,28 @@ enable multiple minor modes for the same regexp.")
|
|||
;; File+dir local variables are initialized after the major mode and its hooks
|
||||
;; have run. If you want hook functions to be aware of these customizations, add
|
||||
;; them to MODE-local-vars-hook instead.
|
||||
(defun doom|run-local-var-hooks ()
|
||||
"Run MODE-local-vars-hook after local variables are initialized."
|
||||
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
||||
#'doom-try-run-hook))
|
||||
(add-hook 'hack-local-variables-hook #'doom|run-local-var-hooks)
|
||||
(add-hook 'hack-local-variables-hook
|
||||
(defun doom-run-local-var-hooks-h ()
|
||||
"Run MODE-local-vars-hook after local variables are initialized."
|
||||
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
||||
#'doom-try-run-hook)))
|
||||
|
||||
;; If `enable-local-variables' is disabled, then `hack-local-variables-hook' is
|
||||
;; never triggered.
|
||||
(defun doom|run-local-var-hooks-if-necessary ()
|
||||
"Run `doom|run-local-var-hooks' if `enable-local-variables' is disabled."
|
||||
(unless enable-local-variables
|
||||
(doom|run-local-var-hooks)))
|
||||
(add-hook 'after-change-major-mode-hook #'doom|run-local-var-hooks-if-necessary 'append)
|
||||
(add-hook 'after-change-major-mode-hook
|
||||
(defun doom-run-local-var-hooks-if-necessary-h ()
|
||||
"Run `doom-run-local-var-hooks-h' if `enable-local-variables' is disabled."
|
||||
(unless enable-local-variables
|
||||
(doom-run-local-var-hooks-h)))
|
||||
'append)
|
||||
|
||||
(defun doom|create-non-existent-directories ()
|
||||
"Automatically create missing directories when creating new files."
|
||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||
(when (and (not (file-exists-p parent-directory))
|
||||
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
||||
(make-directory parent-directory t))))
|
||||
(add-hook 'find-file-not-found-functions #'doom|create-non-existent-directories)
|
||||
(add-hook 'find-file-not-found-functions
|
||||
(defun doom-create-missing-directories-h ()
|
||||
"Automatically create missing directories when creating new files."
|
||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||
(when (and (not (file-exists-p parent-directory))
|
||||
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
||||
(make-directory parent-directory t)))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -297,7 +298,7 @@ broken up into:
|
|||
This is already done by the lang/org module, however.
|
||||
|
||||
If you want to disable incremental loading altogether, either remove
|
||||
`doom|load-packages-incrementally' from `emacs-startup-hook' or set
|
||||
`doom-load-packages-incrementally-h' from `emacs-startup-hook' or set
|
||||
`doom-incremental-first-idle-timer' to nil.")
|
||||
|
||||
(defvar doom-incremental-first-idle-timer 2
|
||||
|
@ -333,18 +334,17 @@ intervals."
|
|||
reqs t)
|
||||
(doom-log "Finished incremental loading")))))))
|
||||
|
||||
(defun doom|load-packages-incrementally ()
|
||||
"Begin incrementally loading packages in `doom-incremental-packages'.
|
||||
(add-hook 'window-setup-hook
|
||||
(defun doom-load-packages-incrementally-h ()
|
||||
"Begin incrementally loading packages in `doom-incremental-packages'.
|
||||
|
||||
If this is a daemon session, load them all immediately instead."
|
||||
(if (daemonp)
|
||||
(mapc #'require (cdr doom-incremental-packages))
|
||||
(when (integerp doom-incremental-first-idle-timer)
|
||||
(run-with-idle-timer doom-incremental-first-idle-timer
|
||||
nil #'doom-load-packages-incrementally
|
||||
(cdr doom-incremental-packages) t))))
|
||||
|
||||
(add-hook 'window-setup-hook #'doom|load-packages-incrementally)
|
||||
(if (daemonp)
|
||||
(mapc #'require (cdr doom-incremental-packages))
|
||||
(when (integerp doom-incremental-first-idle-timer)
|
||||
(run-with-idle-timer doom-incremental-first-idle-timer
|
||||
nil #'doom-load-packages-incrementally
|
||||
(cdr doom-incremental-packages) t)))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -392,23 +392,23 @@ Meant to be used with `run-hook-wrapped'."
|
|||
(unless (file-directory-p dir)
|
||||
(make-directory dir t))))
|
||||
|
||||
(defun doom|display-benchmark (&optional return-p)
|
||||
(defun doom-display-benchmark-h (&optional return-p)
|
||||
"Display a benchmark, showing number of packages and modules, and how quickly
|
||||
they were loaded at startup.
|
||||
|
||||
If RETURN-P, return the message as a string instead of displaying it."
|
||||
(funcall (if return-p #'format #'message)
|
||||
"Doom loaded %s packages across %d modules in %.03fs"
|
||||
(length package-activated-list)
|
||||
"Doom loaded %d packages across %d modules in %.03fs"
|
||||
(- (length load-path) (length doom--initial-load-path))
|
||||
(if doom-modules (hash-table-count doom-modules) 0)
|
||||
(or doom-init-time
|
||||
(setq doom-init-time (float-time (time-subtract (current-time) before-init-time))))))
|
||||
|
||||
(defun doom|run-all-startup-hooks ()
|
||||
(defun doom-run-all-startup-hooks-h ()
|
||||
"Run all startup Emacs hooks. Meant to be executed after starting Emacs with
|
||||
-q or -Q, for example:
|
||||
|
||||
emacs -Q -l init.el -f doom|run-all-startup-hooks"
|
||||
emacs -Q -l init.el -f doom-run-all-startup-hooks-h"
|
||||
(run-hook-wrapped 'after-init-hook #'doom-try-run-hook)
|
||||
(setq after-init-time (current-time))
|
||||
(dolist (hook (list 'delayed-warnings-hook
|
||||
|
@ -522,7 +522,7 @@ to least)."
|
|||
(require 'core-os)
|
||||
(if noninteractive
|
||||
(require 'core-cli)
|
||||
(add-hook 'window-setup-hook #'doom|display-benchmark)
|
||||
(add-hook 'window-setup-hook #'doom-display-benchmark-h)
|
||||
(require 'core-keybinds)
|
||||
(require 'core-ui)
|
||||
(require 'core-projects)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue