dev: merge branch 'master'
This commit is contained in:
commit
4cfb00a0e5
23 changed files with 111 additions and 111 deletions
|
@ -300,7 +300,8 @@ list remains lean."
|
|||
(and (eq (car-safe build) :not)
|
||||
(setq want-byte-compile (not want-byte-compile)
|
||||
want-native-compile (not want-native-compile)))
|
||||
(unless (featurep 'native-compile)
|
||||
(when (or (not (featurep 'native-compile))
|
||||
(not straight--native-comp-available))
|
||||
(setq want-native-compile nil))
|
||||
(and (or want-byte-compile want-native-compile)
|
||||
(or (file-newer-than-file-p repo-dir build-dir)
|
||||
|
|
|
@ -36,14 +36,14 @@ This is the equivalent of running autoremove, install, autoloads, then
|
|||
recompile. Run this whenever you:
|
||||
|
||||
1. Modify your `doom!' block,
|
||||
2. Add or remove `package!' blocks to your config,
|
||||
3. Add or remove autoloaded functions in module autoloaded files,
|
||||
4. Update Doom outside of Doom (e.g. with git),
|
||||
2. Add, remove, or modify `package!' blocks to your config,
|
||||
3. Add, remove, or modify autoloaded functions in module autoloaded files,
|
||||
4. Update Doom manually (e.g. with git),
|
||||
5. Move your Doom config (either $EMACSDIR or $DOOMDIR) to a new location.
|
||||
6. When you up (or down) grade Emacs itself.
|
||||
6. Up or downgrade Emacs itself (e.g. 29.1 -> 29.4).
|
||||
|
||||
It will ensure that unneeded packages are removed, all needed packages are
|
||||
installed, autoloads files are up-to-date and no byte-compiled files have gone
|
||||
Sync'ing ensures that unneeded packages are removed, needed packages are
|
||||
installed, autoloads files are up-to-date, and no byte-compiled files have gone
|
||||
stale.
|
||||
|
||||
OPTIONS:
|
||||
|
|
|
@ -450,6 +450,8 @@ files, so this replace calls to `pp' with the much faster `prin1'."
|
|||
;; REVIEW Suppress byte-compiler warning spawning a *Compile-Log* buffer at
|
||||
;; startup. This can be removed once gilbertw1/better-jumper#2 is merged.
|
||||
(defvar better-jumper-local-mode nil)
|
||||
;; REVIEW: Remove if/when gilbertw1/better-jumper#26 is addressed.
|
||||
(defvaralias 'evil--jumps-jump-command 'evil--jumps-jumping-backard)
|
||||
:init
|
||||
(global-set-key [remap evil-jump-forward] #'better-jumper-jump-forward)
|
||||
(global-set-key [remap evil-jump-backward] #'better-jumper-jump-backward)
|
||||
|
@ -575,8 +577,8 @@ files, so this replace calls to `pp' with the much faster `prin1'."
|
|||
(lambda (button)
|
||||
(helpful-variable (button-get button 'apropos-symbol))))))
|
||||
|
||||
(when (> emacs-major-version 28)
|
||||
;; REVIEW This should be reported upstream to Emacs.
|
||||
;; DEPRECATED: Remove when support for 29 is dropped.
|
||||
(when (= emacs-major-version 29)
|
||||
(defadvice! doom--find-function-search-for-symbol-save-excursion-a (fn &rest args)
|
||||
"Suppress cursor movement by `find-function-search-for-symbol'.
|
||||
|
||||
|
|
|
@ -64,12 +64,13 @@
|
|||
;; usage, however!
|
||||
(setq inhibit-compacting-font-caches t)
|
||||
|
||||
;; PGTK builds only: this timeout adds latency to frame operations, like
|
||||
;; `make-frame-invisible', which are frequently called without a guard because
|
||||
;; it's inexpensive in non-PGTK builds. Lowering the timeout from the default
|
||||
;; 0.1 should make childframes and packages that manipulate them (like `lsp-ui',
|
||||
;; `company-box', and `posframe') feel much snappier. See emacs-lsp/lsp-ui#613.
|
||||
(eval-when! (boundp 'pgtk-wait-for-event-timeout)
|
||||
;; PGTK builds only: there's a timeout that adds latency to frame operations,
|
||||
;; like `make-frame-invisible', which Emacs frequently calls without a guard
|
||||
;; because it's inexpensive in non-PGTK builds. Lowering the timeout from the
|
||||
;; default 0.1 should make childframes and packages that manipulate them (like
|
||||
;; `lsp-ui', `company-box', and `posframe') feel much snappier. See
|
||||
;; emacs-lsp/lsp-ui#613.
|
||||
(when (boundp 'pgtk-wait-for-event-timeout)
|
||||
(setq pgtk-wait-for-event-timeout 0.001))
|
||||
|
||||
;; Increase how much is read from processes in a single chunk (default is 4kb).
|
||||
|
@ -82,7 +83,7 @@
|
|||
|
||||
;; Performance on Windows is considerably worse than elsewhere. We'll need
|
||||
;; everything we can get.
|
||||
(eval-when! (boundp 'w32-get-true-file-attributes)
|
||||
(when (boundp 'w32-get-true-file-attributes)
|
||||
(setq w32-get-true-file-attributes nil ; decrease file IO workload
|
||||
w32-pipe-read-delay 0 ; faster IPC
|
||||
w32-pipe-buffer-size (* 64 1024))) ; read more at a time (was 4K)
|
||||
|
@ -90,8 +91,8 @@
|
|||
;; The GC introduces annoying pauses and stuttering into our Emacs experience,
|
||||
;; so we use `gcmh' to stave off the GC while we're using Emacs, and provoke it
|
||||
;; when it's idle. However, if the idle delay is too long, we run the risk of
|
||||
;; runaway memory usage in busy sessions. If it's too low, then we may as well
|
||||
;; not be using gcmh at all.
|
||||
;; runaway memory usage in busy sessions. And if it's too low, then we may as
|
||||
;; well not be using gcmh at all.
|
||||
(setq gcmh-idle-delay 'auto ; default is 15s
|
||||
gcmh-auto-idle-delay-factor 10
|
||||
gcmh-high-cons-threshold (* 16 1024 1024)) ; 16mb
|
||||
|
@ -124,11 +125,10 @@
|
|||
;; disabling Emacs' menu-bar also makes MacOS treat Emacs GUI frames like
|
||||
;; non-application windows (e.g. it won't capture focus on activation, among
|
||||
;; other things), so the menu-bar should be preserved there.
|
||||
;;
|
||||
(when doom--system-macos-p
|
||||
;; NOTE: The correct way to disable this hack is to toggle `menu-bar-mode' (or
|
||||
;; put it on a hook). Don't try to undo the hack below, as it may change
|
||||
;; without warning, but will always respect `menu-bar-mode'.
|
||||
;; NOTE: Don't try to undo the hack below, as it may change without warning.
|
||||
;; Instead, toggle `menu-bar-mode' (or put it on a hook) as normal. This
|
||||
;; hack will always try to respect the state of `menu-bar-mode'.
|
||||
(setcdr (assq 'menu-bar-lines default-frame-alist) 'tty)
|
||||
(add-hook! 'after-make-frame-functions
|
||||
(defun doom--init-menu-bar-on-macos-h (&optional frame)
|
||||
|
@ -357,8 +357,8 @@ If RETURN-P, return the message as a string instead of displaying it."
|
|||
;; and ~/_emacs) -- and spare us the IO of searching for them, and allows
|
||||
;; savvy hackers to use $EMACSDIR as their $DOOMDIR, if they wanted.
|
||||
;; 3. Cut down on unnecessary logic in Emacs' bootstrapper.
|
||||
;; 4. Offer a more user-friendly error state/screen, especially for errors
|
||||
;; emitted from Doom's core or the user's config.
|
||||
;; 4. TODO Offer a more user-friendly error state/screen, especially for
|
||||
;; errors emitted from Doom's core or the user's config.
|
||||
(define-advice startup--load-user-init-file (:override (&rest _) init-doom 100)
|
||||
(let ((debug-on-error-from-init-file nil)
|
||||
(debug-on-error-should-be-set nil)
|
||||
|
|
|
@ -537,7 +537,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(nreverse new-specs)))
|
||||
(put face 'face-modified nil))
|
||||
('error
|
||||
(ignore-errors (doom--reset-inhibited-vars-h))
|
||||
(if (string-prefix-p "Font not available" (error-message-string e))
|
||||
(signal 'doom-font-error (list (font-get (cdr map) :family)))
|
||||
(signal (car e) (cdr e))))))
|
||||
|
|
106
lisp/doom.el
106
lisp/doom.el
|
@ -148,8 +148,9 @@
|
|||
(push 'harfbuzz features))
|
||||
|
||||
;; The `native-compile' feature exists whether or not it is functional (e.g.
|
||||
;; libgcc is available or not). This seems silly, so pretend it doesn't exist if
|
||||
;; it isn't functional.
|
||||
;; libgcc is available or not). This seems silly, as some packages will blindly
|
||||
;; use the native-comp API if it's present, whether or not it's functional. so
|
||||
;; pretend it doesn't exist if that's the case.
|
||||
(if (featurep 'native-compile)
|
||||
(if (not (native-comp-available-p))
|
||||
(delq 'native-compile features)))
|
||||
|
@ -193,7 +194,7 @@
|
|||
;;; Core globals
|
||||
|
||||
(defgroup doom nil
|
||||
"An Emacs framework for the stubborn martian hacker."
|
||||
"A development framework for Emacs configurations and Emacs Lisp projects."
|
||||
:link '(url-link "https://doomemacs.org")
|
||||
:group 'emacs)
|
||||
|
||||
|
@ -205,7 +206,7 @@
|
|||
"Current version of Doom Emacs.")
|
||||
|
||||
(defvar doom-init-time nil
|
||||
"The time it took, in seconds, for Doom Emacs to initialize.")
|
||||
"The time it took, in seconds (as a float), for Doom Emacs to start up.")
|
||||
|
||||
(defconst doom-profile
|
||||
(if-let (profile (getenv-internal "DOOMPROFILE"))
|
||||
|
@ -306,11 +307,11 @@ For profile-local cache files, use `doom-profile-cache-dir' instead.")
|
|||
(file-name-concat doom-local-dir "state/"))
|
||||
"Where Doom stores its global state files.
|
||||
|
||||
State files contain unessential, unportable, but persistent data which, if lost
|
||||
won't cause breakage, but may be inconvenient as they cannot be automatically
|
||||
regenerated or restored. For example, a recently-opened file list is not
|
||||
essential, but losing it means losing this record, and restoring it requires
|
||||
revisiting all those files.
|
||||
State files contain unessential, non-portable, but persistent data which, if
|
||||
lost won't cause breakage, but may be inconvenient as they cannot be
|
||||
automatically regenerated or restored. For example, a recently-opened file list
|
||||
is not essential, but losing it means losing this record, and restoring it
|
||||
requires revisiting all those files.
|
||||
|
||||
Use this for: history, logs, user-saved data, autosaves/backup files, known
|
||||
projects, recent files, bookmarks.
|
||||
|
@ -332,7 +333,7 @@ For profile-local state files, use `doom-profile-state-dir' instead.")
|
|||
|
||||
(defconst doom-profile-dir
|
||||
(file-name-concat doom-profile-data-dir "@" (cdr doom-profile))
|
||||
"Where generated files for the active profile are kept.")
|
||||
"Where generated files for the active profile (for Doom's core) are kept.")
|
||||
|
||||
;; DEPRECATED: Will be moved to cli/env
|
||||
(defconst doom-env-file
|
||||
|
@ -393,10 +394,10 @@ users).")
|
|||
|
||||
(unless noninteractive
|
||||
;; PERF: Resizing the Emacs frame (to accommodate fonts that are smaller or
|
||||
;; larger than the system font) appears to impact startup time
|
||||
;; larger than the default system font) can impact startup time
|
||||
;; dramatically. The larger the delta, the greater the delay. Even trivial
|
||||
;; deltas can yield up to a ~1000ms loss, depending on font size and
|
||||
;; `window-system'. PGTK seems least affected and NS/MAC the most.
|
||||
;; deltas can yield up to a ~1000ms loss, depending also on
|
||||
;; `window-system' (PGTK builds seem least affected and NS/MAC the most).
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
;; PERF: A fair bit of startup time goes into initializing the splash and
|
||||
|
@ -432,14 +433,14 @@ users).")
|
|||
(selected-frame) nil t))))
|
||||
|
||||
;; PERF: `load-suffixes' and `load-file-rep-suffixes' are consulted on each
|
||||
;; `require' and `load'. Doom won't load any modules this early, so omit
|
||||
;; .so for a tiny startup boost. Is later restored in doom-start.
|
||||
;; `require' and `load'. Doom won't load any modules this early, so I omit
|
||||
;; *.so for a tiny startup boost. Is later restored in `doom-start'.
|
||||
(put 'load-suffixes 'initial-value (default-toplevel-value 'load-suffixes))
|
||||
(put 'load-file-rep-suffixes 'initial-value (default-toplevel-value 'load-file-rep-suffixes))
|
||||
(set-default-toplevel-value 'load-suffixes '(".elc" ".el"))
|
||||
(set-default-toplevel-value 'load-file-rep-suffixes '(""))
|
||||
;; COMPAT: Undo any problematic startup optimizations; from this point, I
|
||||
;; make no assumptions about what might be loaded in userland.
|
||||
;; COMPAT: Undo any problematic startup optimizations eventually, to prevent
|
||||
;; incompatibilities with anything loaded in userland.
|
||||
(add-hook! 'doom-before-init-hook
|
||||
(defun doom--reset-load-suffixes-h ()
|
||||
(setq load-suffixes (get 'load-suffixes 'initial-value)
|
||||
|
@ -458,10 +459,10 @@ users).")
|
|||
(setq custom-dont-initialize nil)))
|
||||
|
||||
;; PERF: The mode-line procs a couple dozen times during startup, before the
|
||||
;; user can even see the first mode-line. This is normally fast, but we
|
||||
;; can't predict what the user (or packages) will put into the mode-line.
|
||||
;; Also, mode-line packages have a bad habit of throwing performance to
|
||||
;; the wind, so best we just disable the mode-line until we can see one.
|
||||
;; user even sees the first mode-line. This is normally fast, but we can't
|
||||
;; predict what the user (or packages) will put into the mode-line. Also,
|
||||
;; mode-line packages have a bad habit of throwing performance to the
|
||||
;; wind, so best we just disable the mode-line until we can see one.
|
||||
(put 'mode-line-format 'initial-value (default-toplevel-value 'mode-line-format))
|
||||
(setq-default mode-line-format nil)
|
||||
(dolist (buf (buffer-list))
|
||||
|
@ -475,10 +476,9 @@ users).")
|
|||
;; garbled after startup (or in case of an startup error).
|
||||
(defun doom--reset-inhibited-vars-h ()
|
||||
(setq-default inhibit-redisplay nil
|
||||
;; Inhibiting `message' only prevents redraws and
|
||||
inhibit-message nil)
|
||||
(redraw-frame))
|
||||
(add-hook 'after-init-hook #'doom--reset-inhibited-vars-h)
|
||||
(remove-hook 'post-command-hook #'doom--reset-inhibited-vars-h))
|
||||
(add-hook 'post-command-hook #'doom--reset-inhibited-vars-h -100)
|
||||
|
||||
;; PERF: Doom disables the UI elements by default, so that there's less for
|
||||
;; the frame to initialize. However, `tool-bar-setup' is still called and
|
||||
|
@ -497,29 +497,25 @@ users).")
|
|||
(put 'site-run-file 'initial-value site-run-file)
|
||||
(setq site-run-file nil)
|
||||
|
||||
(define-advice startup--load-user-init-file (:around (fn &rest args) undo-hacks)
|
||||
(define-advice startup--load-user-init-file (:around (fn &rest args) undo-hacks 95)
|
||||
"Undo Doom's startup optimizations to prep for the user's session."
|
||||
(let (init)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(when (setq site-run-file (get 'site-run-file 'initial-value))
|
||||
(let ((inhibit-startup-screen inhibit-startup-screen))
|
||||
(letf! ((defun load-file (file) (load file nil 'nomessage))
|
||||
(defun load (file &optional noerror _nomessage &rest args)
|
||||
(apply load file noerror t args)))
|
||||
(load site-run-file t t))))
|
||||
(apply fn args) ; start up as normal
|
||||
(setq init t))
|
||||
(when (or (not init) init-file-had-error)
|
||||
;; If we don't undo our inhibit-{message,redisplay} and there's an
|
||||
;; error, we'll see nothing but a blank Emacs frame.
|
||||
(doom--reset-inhibited-vars-h))
|
||||
;; COMPAT: Once startup is sufficiently complete, undo our earlier
|
||||
;; optimizations to reduce the scope of potential edge cases.
|
||||
(advice-remove #'tool-bar-setup #'ignore)
|
||||
(add-transient-hook! 'tool-bar-mode (tool-bar-setup))
|
||||
(unless (default-toplevel-value 'mode-line-format)
|
||||
(setq-default mode-line-format (get 'mode-line-format 'initial-value))))))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(when (setq site-run-file (get 'site-run-file 'initial-value))
|
||||
(let ((inhibit-startup-screen inhibit-startup-screen))
|
||||
(letf! ((defun load-file (file) (load file nil 'nomessage))
|
||||
(defun load (file &optional noerror _nomessage &rest args)
|
||||
(apply load file noerror t args)))
|
||||
(load site-run-file t t))))
|
||||
(apply fn args))
|
||||
;; Now it's safe to be verbose.
|
||||
(setq-default inhibit-message nil)
|
||||
;; COMPAT: Once startup is sufficiently complete, undo our earlier
|
||||
;; optimizations to reduce the scope of potential edge cases.
|
||||
(advice-remove #'tool-bar-setup #'ignore)
|
||||
(add-transient-hook! 'tool-bar-mode (tool-bar-setup))
|
||||
(unless (default-toplevel-value 'mode-line-format)
|
||||
(setq-default mode-line-format (get 'mode-line-format 'initial-value)))))
|
||||
|
||||
;; PERF: Unset a non-trivial list of command line options that aren't
|
||||
;; relevant to this session, but `command-line-1' still processes.
|
||||
|
@ -540,14 +536,14 @@ empty. Each context describes what phase Doom is in, and may respond to.
|
|||
|
||||
All valid contexts:
|
||||
cli -- while executing a Doom CLI
|
||||
compile -- while byte-compilation is in progress
|
||||
eval -- during inline evaluation of elisp
|
||||
compile -- while byte-compiling packages
|
||||
eval -- during interactive evaluation of elisp
|
||||
init -- while doom is formally starting up for the first time, after its
|
||||
core libraries are loaded, but before user config is.
|
||||
modules -- while loading modules and their files
|
||||
sandbox -- This session was launched from Doom's sandbox.
|
||||
packages -- when packagedefs are being read
|
||||
reload -- while reloading doom")
|
||||
core libraries are loaded, but before $DOOMDIR is
|
||||
modules -- while loading modules configuration files (but not packages)
|
||||
sandbox -- This session was launched from Doom's sandbox
|
||||
packages -- while a module's packages.el's file is being evaluated
|
||||
reload -- while reloading doom with `doom/reload'")
|
||||
(put 'doom-context 'valid-values '(cli compile eval init modules packages reload doctor sandbox))
|
||||
(put 'doom-context 'risky-local-variable t)
|
||||
|
||||
|
@ -558,7 +554,9 @@ All valid contexts:
|
|||
(list context "Unrecognized context" valid)))))
|
||||
|
||||
(defun doom-context-p (context)
|
||||
"Return t if CONTEXT is active (i.e. in `doom-context')."
|
||||
"Return t if CONTEXT is active, nil otherwise.
|
||||
|
||||
See `doom-context' for possible values for CONTEXT."
|
||||
(if (memq context doom-context) t))
|
||||
|
||||
(defun doom-context-push (context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue