Commit Graph

207 Commits

Author SHA1 Message Date
f99cf0ccc8 feat(cli): introduce DOOMPROFILELOAD{FILE,PATH} envvars
- Adds $DOOMPROFILELOADFILE: Controls where to read and write the
  profile loader. Changing this may be helpful for users on nix/guix,
  who have deployed Doom to a read-only location. This sets
  `doom-profile-load-file`.
- Changed profile load file's default location (used to be
  $EMACSDIR/profiles/init.el, is now $EMACSDIR/profiles/load.el). The
  gitignore was updated to reflect this.
- Adds $DOOMPROFILELOADPATH: A colon-delimited list of profile config
  files and directories (semi-colon on Windows) which dictate what Doom
  reads in order to discover your profiles. Config files are required to
  have an *.el extension. This sets `doom-profile-load-path`.
- Changes the nomenclature around this loader script. I used to refer to
  it as the profile bootstrapper. I'll now refer to it as the profile
  load file, and I've renamed `doom-profiles-bootstrap-file` to
  `doom-profile-load-file` to reflect this.
- The variables `doom-profile-dirs` and `doom-profile-config-files` were
  merged into doom-profile-load-path.
- Both envvars have also been documented in `doom help` (and
  $DOOMPROFILE's has been updated).

Ref: #6794
2022-09-18 00:28:13 +02:00
dc107e4a15 refactor: restore doom-profile-default
And throw errors if a profile has the same name as the default (_).
2022-09-17 21:41:43 +02:00
21f2ad58b5 fix(cli): ensure doom envvars are set for post-script sessions
Particularly DOOMPROFILE, without which the --profile switch wasn't
actually doing anything, and profile sessions would (silently) use the
default user-emacs-directory and doom-user-dir.
2022-09-17 21:41:42 +02:00
6dffa09c71 refactor(profiles): bootstrap script
- Swap out the funcall+alist lookup for a pcase (which is expanded to a
  cond, which is is faster and easier to read).
- Wrap bootstrap file to $EMACSDIR/profiles/init.el, but byte-compile it
  to $EMACSDIR/profiles/init.X.el where X is emacs-major-version.
- Make doom-profiles-save's second argument optional (defaults to
  doom-profiles-bootstrap-file).
- Make doom-profiles-save throw a error if byte-compilation fails for
  some reason.
- Rename the tempvars to include 'doom' in their name, so debuggers know
  where they originate.
2022-09-17 21:41:42 +02:00
09d24cd68a fix(cli): type error trying to split a cons cell
doom-profile was changed to a cons cell in 18cd2eb.

Amend: 18cd2eb483
2022-09-17 21:41:42 +02:00
a726ba33b9 tweak: use doom-profile-*-dir for core dir/file vars
In this commit I start using doom-profile-*-dir vars, though it will
make no difference to the default Doom install (only to profiles, and in
the future, in v3, where we'll drop $EMACSDIR/.local entirely).
2022-09-17 21:41:42 +02:00
25bc9c9765 fix: defconst->defvar for more doom-*-dir vars
So they can be changed before doom.el is loaded (e.g. by profiles).
2022-09-17 21:41:42 +02:00
4a3654d666 refactor(cli): read $DEBUG in early-init.el instead
This opens up $DEBUG as an alternative to --debug-init, and allows more
of the startup process to react to it.
2022-09-17 21:41:42 +02:00
7fec2cf5bb tweak(profiles): regen profiles if generator version changed
The profile bootstrap file's first form is the doom-version it was
generated with. If this has changed, it should be considered outdated,
even if the user's profiles haven't changed.
2022-09-17 21:41:42 +02:00
36a9637e79 fix(profiles): no bootstrap file for non-bootloaders
If Doom doesn't live in ~/.emacs.d or ~/.config/emacs, then it cannot
play the role of bootloader, so opt out of generating the profile
bootstrappper in this case.

That said, don't disable the profile system entirely; it can still be
useful for internal, noninteractive, and sandbox use.
2022-09-17 15:29:17 +02:00
753b479ea6 feat(cli): add --reload switch to 'profiles sync'
So 'doom profiles sync' can be relied on to forcibly regenerate the
profile init by default.
2022-09-17 15:11:48 +02:00
edf54a398b tweak(profiles): suppress profile init compilation warnings
It's not useful information, but should still be emitted if debug mode
is on.
2022-09-17 15:11:47 +02:00
750d75a45b refactor(profiles): simplify profile init file
So that the resulting file expands to less code and doesn't apply too
magic to file paths (it may be unwanted).

And don't try to unintern a lexical binding.
2022-09-17 15:11:47 +02:00
329d65d0d4 fix(profiles): unexpanded paths in implicit profiles
Fixes two issues with implicit profiles:

1. Where user-emacs-directory (and sometimes doom-user-dir) would be
   unexpanded in the profile init file (generated by 'doom profiles
   sync'), which would be ineffective at runtime.
2. Where an implicit profile with a .doomprofile that lacks a
   user-emacs-directory setting would not have any user-emacs-directory
   set for it at all. Instead, it should fall back to that profile's
   location.
2022-09-17 15:11:47 +02:00
fd61150f60 refactor: local-vars: don't intern unneeded symbols
If the hook doesn't exist, it hasn't been bound to, and doom-run-hooks
will no-op if passed a nil. Saves a tiny bit on memory usage.
2022-09-17 12:12:11 +02:00
00e8f6b72a fix: don't require doom-local-dir end with a slash 2022-09-17 11:00:08 +02:00
811c18ca68 fix(cli): remove redundant comp-effective-async-max-jobs advice
Amend: 51a9745f38
2022-09-16 19:20:45 +02:00
fe602fe9cd fix(lib): suppress 'Function X is already compiled'
Emitted from `byte-compile`.
2022-09-16 19:19:55 +02:00
51a9745f38 perf: native-comp: use 1/4 of your cores instead of 1/2
The sudden spike in CPU and memory utilization alarms people, so I've
reduced how many cores native-comp will use. In non-interactive
sessions, it will use all of them, however (that is, when I later
introduce an AOT switch).

You can still override this by setting native-comp-async-jobs-number or
comp-num-cpus yourself.

I use advice instead of setting comp-num-cpus so that users to avoid
trampling on default behavior, or attempts by the user to change them.
2022-09-16 19:09:34 +02:00
0694be43ee fix(cli): reference to free variable id
Fix: #6791
2022-09-16 19:09:34 +02:00
3ba56eb008 fix(lib): ignore doom-compile-functions failures
It really isn't important if this function succeeds or not, but it seems
its stability is highly variable, dependent on your specific build and
version of Emacs. Since there are a lot of 29 Doom users, best to be
more permissive and simply fall back to byte-compilation if native-comp
fails.
2022-09-16 19:09:28 +02:00
58c0de6841 fix: menu-bar not disabled in some instances
It seems unsetting menu-bar-mode is enough on *some* builds of Emacs,
but not all. Best we cover all the bases.

Amend: 4a253757cb
Fix: #6790
2022-09-16 18:27:04 +02:00
9121100bb4 fix(cli): remove redundant doom-env-file
Causing the envvar file to be generated to wrong place, and thus never
be updated/properly loaded at runtime.

This new setting is for later, where I'll integrate the envvar generate
into the profile generator proper.
2022-09-16 17:06:49 +02:00
732d87ac3e nit: minor comment revision and refactors 2022-09-16 17:01:57 +02:00
c5e88d229f fix(lib): doom-compile-function throwing native-compiler-error 2022-09-16 16:15:07 +02:00
3f866983e5 refactor(lib): doom-load 2022-09-16 13:07:28 +02:00
b804a2f34f refactor(lib): convert cli/autoloads.el to lib 2022-09-16 13:07:28 +02:00
7ea4b21953 fix(cli): remove vestigial doom-initialize-modules calls
Fix: #6784
2022-09-16 13:07:28 +02:00
ab9896c526 refactor(org): move doom-docs link defs to :lang org
Where they will be further generalized, later.

This also prevents an issue where org was loaded while the profile init
files are generated, which caused a warning about org-loaddefs which
introduces a noticable delay.
2022-09-16 13:06:17 +02:00
9cbc173e0d fix(lib): update doom/reload-autoloads
To reflect recent changes (particularly b914830).

Amend: b914830403
2022-09-16 03:17:46 +02:00
39197618ec fix(lib): only set doom-print-minimum-level in debug-mode 2022-09-16 03:17:46 +02:00
354d71566a fix: inhibit-null-byte-detection = t at startup 2022-09-16 03:08:29 +02:00
00ff149ebe fix(cli): print-group-if! -> print-group! + :if
Remove some vestigial references to the former, which was replaced with
the latter in b7bd27d.

Amend: b7bd27d22b
2022-09-16 02:42:48 +02:00
7b1ac7cdc1 fix(cli): doom-autoloads-reload -> doom-profile-generate
Remove vestigial references to the former, which was replaced with the
latter in b914830.

Amend: b914830403
2022-09-16 02:42:30 +02:00
cc0e6a61c3 fix(cli): add lisp/cli/profiles.el
I forgot to add the definitions for the 'doom profile{s,}' commands in
b914830, which causes "unrecognized command 'profiles sync'" errors on
'doom {sync,upgrade}'.

My unparalleled brilliance is 4 parallel universes ahead of me, clearly.

Amend: b914830403
2022-09-16 02:26:00 +02:00
b395bd5392 refactor: use print! to emit doom! module warnings 2022-09-16 01:14:25 +02:00
b598d41ffb nit: correct comment header about startup optimizations
To claim they're ordered by effectiveness was silly of me, and was never
*quite* true, so I remove it altogether.
2022-09-16 01:14:25 +02:00
f34e91d3b9 fix: guard tty-run-terminal-initialization against GUI sessions 2022-09-16 01:14:25 +02:00
aa53ad2c1b fix: load subr-x at compile-time in doom.el
This is more to nip 27.x issues in the bud, where fewer of subr-x's
macros are autoloaded.
2022-09-16 01:14:25 +02:00
e411762e8c refactor: enable module whether or not it exists
The doom-modules table should reflect the user's intentions, not the
actual state of its modules (e.g. by omitting modules that couldn't be
found at activation time).
2022-09-16 01:14:25 +02:00
a9e0156416 docs: update modulep! docstring
To clarify, reflect recent changes, and link to `doom!` for details.
2022-09-16 01:14:24 +02:00
85f3b19f61 docs: revise version check failure message
- Recommend 28.1.
- Swap condition.
2022-09-16 01:14:24 +02:00
c7289da99b fix(cli): suppress redundant logs from straight-prune-build-cache 2022-09-16 01:14:24 +02:00
cba240f88a refactor(cli): move native-comp call into guard
Each of these functions have a native-comp guard, which may be overkill,
but for the time being they should be grouped together, to indicate
their relationship.
2022-09-16 01:14:24 +02:00
a023482c36 perf: delay tool-bar-setup at startup 2022-09-16 01:14:24 +02:00
451933b2ba fix(docs): don't hide # lines in src blocks
This would hide shebang lines and comments in languages that use # as a
line comment delimiter.
2022-09-16 01:14:24 +02:00
c8099a89ad refactor(cli): replace cl-callf+map-delete w/ cl-remf 2022-09-16 01:14:24 +02:00
7e75271933 refactor(cli): precalculate cli & key in doom-cli-aliases 2022-09-16 01:14:24 +02:00
85fac73d37 feat(cli): implement second argument of doom-cli-find
It was intended to be a flag to suppress this function from including
partial CLIs in the returned list, but wasn't actually implemented until
now.
2022-09-16 01:14:24 +02:00
d552dbc878 fix(lib): resolve relative paths in doom-load errors
And don't forward file-missing errors, as this would convolute them.
2022-09-16 01:14:23 +02:00