Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump doom-emacs #316

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ let
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
patches = [
./patches/fix-paths.patch
./patches/defvar-autoload-compute-prefixes.patch
];
installPhase = ''
mkdir -p $out
Expand Down Expand Up @@ -193,7 +194,8 @@ let
src = doomSrc;

patches = [
./patches/nix-integration.patch
./patches/doom-el.patch
./patches/early-init.patch
];

buildPhase = ''
Expand All @@ -217,7 +219,6 @@ let
chmod u+w $out/config.el
cat $extraConfigPath > $out/config.extra.el
cat > $out/config.el << EOF
(load "${./doom-modeline-workarounds.el}")
(load "${doomPrivateDir}/config.el")
(load "$out/config.extra.el")
EOF
Expand Down
Empty file added doom-el.patch
Empty file.
57 changes: 0 additions & 57 deletions doom-modeline-workarounds.el

This file was deleted.

27 changes: 12 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@
description = "nix-doom-emacs home-manager module";

inputs = {
# TODO: change back to master once we get synced back with upstream changes
doom-emacs.url = "github:doomemacs/doomemacs/3853dff5e11655e858d0bfae64b70cb12ef685ac";
doom-emacs.url = "github:doomemacs/doomemacs";
doom-emacs.flake = false;
doom-snippets.url = "github:doomemacs/snippets";
doom-snippets.flake = false;
emacs-overlay.url = "github:nix-community/emacs-overlay/c16be6de78ea878aedd0292aa5d4a1ee0a5da501";
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.flake = false;
emacs-so-long.url = "github:hlissner/emacs-so-long";
emacs-so-long.flake = false;
Expand All @@ -55,7 +54,7 @@
evil-quick-diff.flake = false;
explain-pause-mode.url = "github:lastquestion/explain-pause-mode";
explain-pause-mode.flake = false;
format-all.url = "github:lassik/emacs-format-all-the-code/47d862d40a088ca089c92cd393c6dca4628f87d3";
format-all.url = "github:lassik/emacs-format-all-the-code";
format-all.flake = false;
nix-straight.url = "github:nix-community/nix-straight.el";
nix-straight.flake = false;
Expand Down
15 changes: 15 additions & 0 deletions patches/defvar-autoload-compute-prefixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lisp/cli/packages.el b/lisp/cli/packages.el
index 3026ee789..b8ba50274 100644
--- a/lisp/cli/packages.el
+++ b/lisp/cli/packages.el
@@ -721,8 +721,8 @@ original state.")

(defadvice! doom-cli--straight-no-compute-prefixes-a (fn &rest args)
:around #'straight--build-autoloads
- (let (autoload-compute-prefixes)
- (apply fn args)))
+ (defvar autoload-compute-prefixes)
+ (apply fn args))

(defadvice! doom-cli--straight-fallback-to-tty-prompt-a (fn prompt actions)
"Modifies straight to prompt on the terminal when in noninteractive sessions."
55 changes: 55 additions & 0 deletions patches/doom-el.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/lisp/doom.el b/lisp/doom.el
index f8f91b9aa..00f973551 100644
--- a/lisp/doom.el
+++ b/lisp/doom.el
@@ -220,12 +220,7 @@ These files should not be shared across systems. By default, it is used by

(define-obsolete-variable-alias 'doom-etc-dir 'doom-data-dir "3.0.0")
(defvar doom-data-dir
- (if doom-profile
- (if IS-WINDOWS
- (expand-file-name "doomemacs/data/" (getenv-internal "APPDATA"))
- (expand-file-name "doom/" (or (getenv-internal "XDG_DATA_HOME") "~/.local/share")))
- ;; DEPRECATED: .local will be removed entirely in 3.0
- (file-name-concat doom-local-dir "etc/"))
+ (expand-file-name "doom/" (or (getenv-internal "XDG_DATA_HOME") "~/.local/share"))
"Where Doom stores its global data files.

Data files contain shared and long-lived data that Doom, Emacs, and their
@@ -239,12 +234,7 @@ generated files for profiles, profiles themselves, autoloads/loaddefs, etc.
For profile-local data files, use `doom-profile-data-dir' instead.")

(defvar doom-cache-dir
- (if doom-profile
- (if IS-WINDOWS
- (expand-file-name "doomemacs/cache/" (getenv-internal "APPDATA"))
- (expand-file-name "doom/" (or (getenv-internal "XDG_CACHE_HOME") "~/.cache")))
- ;; DEPRECATED: .local will be removed entirely in 3.0
- (file-name-concat doom-local-dir "cache/"))
+ (expand-file-name "doom/" (or (getenv-internal "XDG_CACHE_HOME") "~/.cache"))
"Where Doom stores its global cache files.

Cache files represent non-essential data that shouldn't be problematic when
@@ -258,12 +248,7 @@ session files, ELPA archives, authinfo files, org-persist, etc.
For profile-local cache files, use `doom-profile-cache-dir' instead.")

(defvar doom-state-dir
- (if doom-profile
- (if IS-WINDOWS
- (expand-file-name "doomemacs/state/" (getenv-internal "APPDATA"))
- (expand-file-name "doom/" (or (getenv-internal "XDG_STATE_HOME") "~/.local/state")))
- ;; DEPRECATED: .local will be removed entirely in 3.0
- (file-name-concat doom-local-dir "state/"))
+ (expand-file-name "doom/" (or (getenv-internal "XDG_STATE_HOME") "~/.local/state"))
"Where Doom stores its global state files.

State files contain non-essential, unportable, but persistent data which, if
@@ -291,7 +276,7 @@ For profile-local state files, use `doom-profile-state-dir' instead.")
"For profile-local state files under `doom-state-dir'.")

(defconst doom-profile-dir
- (file-name-concat doom-profile-data-dir "@" (cdr doom-profile))
+ (file-name-concat doom-local-dir "etc" "@" (cdr doom-profile))
"Where generated files for the active profile are kept.")

;; DEPRECATED: Will be moved to cli/env
118 changes: 118 additions & 0 deletions patches/early-init.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
diff --git a/early-init.el b/early-init.el
index c6e6b4d68..67f72a2b0 100644
--- a/early-init.el
+++ b/early-init.el
@@ -46,97 +46,22 @@
;;
;;; Bootstrap

-(or
- ;; PERF: `file-name-handler-alist' is consulted often. Unsetting it offers a
- ;; notable saving in startup time. This let-binding is just a stopgap though,
- ;; a more complete version of this optimization can be found in lisp/doom.el.
- (let (file-name-handler-alist)
- (let* (;; FIX: Unset `command-line-args' in noninteractive sessions, to
- ;; ensure upstream switches aren't misinterpreted.
- (command-line-args (unless noninteractive command-line-args))
- ;; I avoid using `command-switch-alist' to process --profile (and
- ;; --init-directory) because it is processed too late to change
- ;; `user-emacs-directory' in time.
- (profile (or (cadr (member "--profile" command-line-args))
- (getenv-internal "DOOMPROFILE"))))
- (if (null profile)
- ;; REVIEW: Backported from Emacs 29. Remove when 28 support is dropped.
- (let ((init-dir (or (cadr (member "--init-directory" command-line-args))
- (getenv-internal "EMACSDIR"))))
- (if (null init-dir)
- ;; FIX: If we've been loaded directly (via 'emacs -batch -l
- ;; early-init.el') or by a doomscript (like bin/doom), and Doom
- ;; is in a non-standard location (and/or Chemacs is used), then
- ;; `user-emacs-directory' will be wrong.
- (when noninteractive
- (setq user-emacs-directory
- (file-name-directory (file-truename load-file-name))))
- ;; FIX: To prevent "invalid option" errors later.
- (push (cons "--init-directory" (lambda (_) (pop argv))) command-switch-alist)
- (setq user-emacs-directory (expand-file-name init-dir))))
- ;; FIX: Discard the switch to prevent "invalid option" errors later.
- (push (cons "--profile" (lambda (_) (pop argv))) command-switch-alist)
- ;; Running 'doom sync' or 'doom profile sync' (re)generates a light
- ;; profile loader in $EMACSDIR/profiles/load.el (or
- ;; $DOOMPROFILELOADFILE), after reading `doom-profile-load-path'. This
- ;; loader requires `$DOOMPROFILE' be set to function.
- (setenv "DOOMPROFILE" profile)
- (or (load (expand-file-name
- (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE")))
- (if lfile
- (concat (string-remove-suffix ".el" lfile)
- ".%d.elc")
- "profiles/load.%d.elc"))
- emacs-major-version)
- user-emacs-directory)
- 'noerror (not init-file-debug) 'nosuffix)
- (user-error "Profiles not initialized yet; run 'doom sync' first"))))
+(let (file-name-handler-alist)
+ (setq user-emacs-directory
+ (file-name-directory (file-truename load-file-name)))

- ;; PERF: When `load'ing or `require'ing files, each permutation of
- ;; `load-suffixes' and `load-file-rep-suffixes' (then `load-suffixes' +
- ;; `load-file-rep-suffixes') is used to locate the file. Each permutation
- ;; is a file op, which is normally very fast, but they can add up over the
- ;; hundreds/thousands of files Emacs needs to load.
- ;;
- ;; To reduce that burden -- and since Doom doesn't load any dynamic modules
- ;; -- I remove `.so' from `load-suffixes' and pass the `must-suffix' arg to
- ;; `load'. See the docs of `load' for details.
- (if (let ((load-suffixes '(".elc" ".el")))
- ;; I avoid `load's NOERROR argument because other, legitimate errors
- ;; (like permission or IO errors) should not be suppressed or
- ;; interpreted as "this is not a Doom config".
- (condition-case _
- ;; Load the heart of Doom Emacs.
- (load (expand-file-name "lisp/doom" user-emacs-directory)
- nil (not init-file-debug) nil 'must-suffix)
- ;; Failing that, assume that we're loading a non-Doom config.
- (file-missing
- ;; HACK: `startup--load-user-init-file' resolves $EMACSDIR from a
- ;; lexically bound `startup-init-directory', which means changes
- ;; to `user-emacs-directory' won't be respected when loading
- ;; $EMACSDIR/init.el, so I force it to:
- (define-advice startup--load-user-init-file (:filter-args (args) reroute-to-profile)
- (list (lambda () (expand-file-name "init.el" user-emacs-directory))
- nil (nth 2 args)))
- ;; Set `user-init-file' for the `load' call further below, and do so
- ;; here while our `file-name-handler-alist' optimization is still
- ;; effective (benefits `expand-file-name'). BTW: Emacs resets
- ;; `user-init-file' and `early-init-file' after this file is loaded.
- (setq user-init-file (expand-file-name "early-init" user-emacs-directory))
- ;; COMPAT: I make no assumptions about the config we're going to
- ;; load, so undo this file's global side-effects.
- (setq load-prefer-newer t)
- ;; PERF: But make an exception for `gc-cons-threshold', which I
- ;; think all Emacs users and configs will benefit from. Still,
- ;; setting it to `most-positive-fixnum' is dangerous if downstream
- ;; does not reset it later to something reasonable, so I use 16mb
- ;; as a best fit guess. It's better than Emacs' 80kb default.
- (setq gc-cons-threshold (* 16 1024 1024))
- nil)))
- ;; ...But if Doom loaded then continue as normal.
- (doom-require (if noninteractive 'doom-cli 'doom-start))))
-
- ;; Then continue on to the config/profile we want to load.
- (load user-init-file 'noerror (not init-file-debug) nil 'must-suffix))
+ ;; PERF: When `load'ing or `require'ing files, each permutation of
+ ;; `load-suffixes' and `load-file-rep-suffixes' (then `load-suffixes' +
+ ;; `load-file-rep-suffixes') is used to locate the file. Each permutation
+ ;; is a file op, which is normally very fast, but they can add up over the
+ ;; hundreds/thousands of files Emacs needs to load.
+ ;;
+ ;; To reduce that burden -- and since Doom doesn't load any dynamic modules
+ ;; -- I remove `.so' from `load-suffixes' and pass the `must-suffix' arg to
+ ;; `load'. See the docs of `load' for details.
+ (load (expand-file-name "lisp/doom" user-emacs-directory)
+ nil (not init-file-debug) nil 'must-suffix)
+ ;; ...But if Doom loaded then continue as normal.
+ (doom-require (if noninteractive 'doom-cli 'doom-start)))

;;; early-init.el ends here
Loading