Commit graph

61 commits

Author SHA1 Message Date
Henrik Lissner
f9de598daa
tweak(lib): doom-info: split byte-compiled-config trait into 3
What used to be a `byte-compiled-config` trait, displayed in your `M-x
doom/info`, is now `compiled-user-config`, `compiled-core`, and
`compiled-modules`, for more helpful granularity for debugging possible
byte-code issues.
2022-09-18 14:01:52 +02:00
Henrik Lissner
e2ce4345d2
bump: :lang org
abo-abo/org-download@947ca22364 -> abo-abo/org-download@19e166f0a8
alf/ob-restclient.el@3ac834b02b -> alf/ob-restclient.el@1b021ce1c6
emacs-straight/org-mode@00adad9357 -> emacs-straight/org-mode@86c4635dba
emacsmirror/org-contrib@39e2abc562 -> emacsmirror/org-contrib@0740bd3fe6
hakimel/reveal.js@e219184f37 -> hakimel/reveal.js@c1c4145240
org-roam/org-roam@7f453f3fff -> org-roam/org-roam@d95d25615e

Close: #6692
Fix: #6691
2022-09-18 13:10:49 +02:00
Henrik Lissner
8fd7e8bed0
fix(lib): doom/reload to reflect recent changes
Fix: #6806
2022-09-18 13:10:49 +02:00
Henrik Lissner
b804a2f34f
refactor(lib): convert cli/autoloads.el to lib 2022-09-16 13:07:28 +02:00
Henrik Lissner
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
Henrik Lissner
9cbc173e0d
fix(lib): update doom/reload-autoloads
To reflect recent changes (particularly b914830).

Amend: b914830403
2022-09-16 03:17:46 +02:00
Henrik Lissner
39197618ec
fix(lib): only set doom-print-minimum-level in debug-mode 2022-09-16 03:17:46 +02:00
Henrik Lissner
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
Henrik Lissner
b183a0835d
feat(lib): add active profile to doom-info 2022-09-16 01:14:23 +02:00
Henrik Lissner
7a2be67efa
refactor!: redesign module init/config hooks
BREAKING CHANGE: For consistency and correctness, I've renamed the
module init/config hooks, and added new ones:

- Adds doom-before-modules-config-hook
- Adds doom-after-modules-config-hook (replaced doom-before-init-modules-hook)
- Adds doom-before-modules-init-hook
- Adds doom-after-modules-init-hook (replaced doom-init-modules-hook)
- Removed doom-after-init-modules-hook (replaced w/ after-init-hook)

The old naming (and timing) was counterintuitive. Now, it's named after
the loaded file group (init.el vs config.el), and I added before/after
variants. Altogether, this should make them less ambiguous.

I've also moved some functions in various modules to more correct hooks.

Load order before this change:
- $EMACSDIR/early-init.el
- $EMACSDIR/lisp/doom.el
- $EMACSDIR/lisp/doom-start.el
- $DOOMDIR/init.el
- {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el
- `doom-before-init-modules-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el
- `doom-init-modules-hook'
- $DOOMDIR/config.el
- `doom-after-init-modules-hook'
- `after-init-hook'
- `emacs-startup-hook'
- `window-setup-hook'

Load order after this change:
- $EMACSDIR/early-init.el
- $EMACSDIR/lisp/doom.el
- $EMACSDIR/lisp/doom-start.el
- $DOOMDIR/init.el
- `doom-before-modules-init-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/init.el
- `doom-after-modules-init-hook'
- `doom-before-modules-config-hook'
- {$DOOMDIR,~/.emacs.d}/modules/*/*/config.el
- `doom-after-modules-config-hook'
- $DOOMDIR/config.el
- `after-init-hook'
- `emacs-startup-hook'
- `window-setup-hook'
2022-09-16 01:14:22 +02:00
Henrik Lissner
3a0f1aa3ef
refactor: register :core & :user as virtual modules
...that are always enabled. This way, the module API treats them as any
other module.

This also changes doom-module-load-path. If supplied directories,
doom-user-dir will not be the CAR of its return value. If no dirs are
supplied, then doom-core-dir and doom-user-dir are included (and will
always be the first two items in the returned list).
2022-09-16 01:14:22 +02:00
Henrik Lissner
0c918f3b2d
refactor: change doom-module-list signature
Used to return the hash-table `doom-modules` (if not all-p), but I've
changed it to return a list of cons cells (:CATEGORY . MODULE),
representing all enabled modules, in the order they were enabled.

The purpose of this change is to prepare for a change in the structure
of doom-modules, and how Doom stores its module metadata.
2022-09-16 01:14:21 +02:00
Henrik Lissner
26914d0369
refactor(lib): use ansi-color-apply
Rather than reimplement its face lookup (and have two versions of
doom-print-ansi-alist -- one for 27.x and one for 28+), let's just rely
on ansi-color.
2022-09-16 01:14:21 +02:00
Henrik Lissner
dde728d847
fix(lib): void-function insert-into-buffer on Emacs 27
insert-into-buffer was introduced in 28.1
2022-09-16 01:14:20 +02:00
Henrik Lissner
b7bd27d22b
refactor(cli,lib): print levels & output redirection
This refactors how Doom captures and redirects its output (to stdout and
stderr) into a more general with-output-to! macro, and:

- Simplifies the "print level" system. The various doom-print-*-level
  variables have been removed.
- Adds a new print level: notice, which will be the default level for
  all standard output (from print!, doom-print, prin[ct1], etc).
- Adds a with-output-to! macro for capturing and redirecting
  output to multiple streams (without suppressing it from stdout). It
  can also be nested.
- Changes the following about doom-print:
  - Default :format changed to nil (was t)
  - Default :level changed to t (was `doom-print-level`)
  - No longer no-ops if OUTPUT is only whitespace
2022-09-16 01:14:20 +02:00
Henrik Lissner
6cac7b05b6
refactor(lib): tidy doom-log output
This commit reduces the debug log noise, makes it easier to
read/parse/search, and soft-introduces a convention for doom-log
messages, where they are prefixed with a unique identifier loosely named
after it's running context or calling function.

I haven't enforced it everywhere doom-log is used yet, but this is a
start.
2022-09-12 16:01:43 +02:00
Henrik Lissner
0ce2989d86
refactor(lib): remove redundant full? arg in doom-glob
file-expand-wildcards already does this check, internally.
2022-09-12 11:45:59 +02:00
Ivan
6af7338140
refactor(lib): remove unreachable code in doom-print-class-alist
An earlier element in this alist associates buffer with
doom-print--buffer, so this later element is unreachable.
2022-09-10 23:51:40 +02:00
Henrik Lissner
45a66cda60
fix: ensure module state is in scope for modulep!
Otherwise, doom-module-from-path (and modulep!) would fail to detect the
module they're in, or at least, modulep! would incorrectly return nil,
even for enabled modules.

This issue is what would've caused the package list or the doctor to
include/consider packages in disabled modules or behind disabled flags.
2022-09-10 19:11:03 +02:00
Henrik Lissner
ce0e3a04b6
tweak(lib): prevent redundant timestamps in logs 2022-09-10 18:36:24 +02:00
Henrik Lissner
78af0eeecb
fix(lib): only set top-level values of debug variables 2022-09-10 18:36:24 +02:00
Henrik Lissner
05d06cc552
tweak(lib): suppress GC logging in debug mode
It happens so often it can overwhelm the echo area. It's still logged
to *Messages* however.
2022-09-10 18:36:24 +02:00
Henrik Lissner
d290152a8e
refactor(lib): replace doom-debugger with advice
Writing a debugger for Elisp is too much hassle. `debug` itself isn't
very customizable without a *lot* of boilerplate, so instead of writing
my own, it's more effective to advise debug instead. Certainly, I don't
do anything with it yet, but I will soon.
2022-09-10 18:36:24 +02:00
Henrik Lissner
6e8de0bd89
refactor(lib): use num-processors
This C function was introduced in Emacs 28.1.
2022-09-08 13:36:17 +02:00
Henrik Lissner
cd269753cf
fix(lib): leave point at bob in with-file-contents!
with-file-contents!'s docstring promises that point will end up at the
beginning of the buffer, but this promise wasn't kept until now.
2022-09-08 00:24:16 +02:00
Henrik Lissner
b121c5e1c6
refactor(lib): provide doom-libs as subfeatures
This allows us to load them via doom-require. Why not use normal
features? Because Doom's libraries are designed to be loaded as part of
Doom, and will openly rely on Doom state if needed; this is a contract I
want to enforce by ensuring their only entry points are through
`doom-require` or autoloading.

I will add them to the rest of the libraries later.

Site-node: this also adds Commentary+Code to the comment headings, as I
want a space to use that space to describe the library, when I get
around to it.
2022-09-08 00:20:26 +02:00
ivanbrennan
1d942b4ab6 fix(lib): doom/version use canonical filenames
If doom-emacs-dir contains a "~", attempting to call `git -C` will fail
with an error like:

  fatal: cannot change to '~/.config/emacs/': No such file or directory

Fix this by canonicalizing the filename.
2022-09-07 00:20:24 +02:00
Henrik Lissner
2b1f6031b2
refactor(lib): rely less on global state for defaults
I prefer to be more explicit about these variables' defaults, then to
rely on proper load order and unverified global state to ensure they're
properly set.
2022-09-06 23:51:44 +02:00
Henrik Lissner
0a51fdff53
refactor(lib): move doom-log to doom-lib
This is such an essential macro that it should be universally available,
and not stowed away in the print library.
2022-09-06 23:46:42 +02:00
Henrik Lissner
48369fb654
fix(lib): add native-comp vars to known debug vars
And reformat the list to distinguish Doom vars from Emacs ones.

Amend: 3853dff5e1
2022-09-06 23:34:56 +02:00
Henrik Lissner
b93f398568
refactor(lib): enforce namespace for helpers 2022-09-06 23:26:05 +02:00
Henrik Lissner
9b4973198b
refactor(lib): use new file API
Ref: 8d4b6b3028
Ref: 83f18402e3
2022-09-06 23:22:01 +02:00
Henrik Lissner
3cfcfc5055
refactor(lib): use with-memoization
Ref: 2b01166d1d
2022-09-06 23:18:49 +02:00
Henrik Lissner
948f9461a7
refactor(cli): merge doom-cli-lib into doom-cli
This was done to purge superfluous files from Doom's project structure
and simplify its entry points. And with early-init.el now acting as
Doom's universal bootstrapper (see c05e615), we don't have enough
bootstrap logic to warrant being its own file.

Also removes the redundant version check, given doom.el is assured to be
loaded before doom-cli, and performs its own check.

Ref: c05e61536e
2022-09-06 23:01:39 +02:00
Henrik Lissner
83f18402e3
feat(lib): add with-file! & with-file-contents! macros
Convenience macros to express more succinctly the with-temp-buffer +
insert-file-contents + write-region idiom for file IO in elisp.
2022-09-06 22:55:48 +02:00
Henrik Lissner
8d4b6b3028
feat(lib): add doom-file-{read,write} functions
A concise alternative to the file IO elisp idioms we're used to,
involving some combination of with-temp-file, with-temp-buffer,
insert-file-contents, coding-system-for-{read,write}, write-region, read
loops, print-to-current-buffer loops, etc.

These were engineered to make reading/writing text and lisp data from/to
files simpler, and will be used extensively in the v3 CLI.
2022-09-06 22:55:48 +02:00
Henrik Lissner
e986d6bef9
refactor(lib): deprecate doom-dir
This function never really added much value over doom-path or
file-name-concat, so I'm phasing it out.
2022-09-06 22:55:48 +02:00
Henrik Lissner
f66d9e1f0e
feat(lib): only return dirs if doom-glob SEGMENTS end with /
Also, doom-glob will return relative paths if SEGMENTS don't form an
absolute path.
2022-09-06 22:55:48 +02:00
Henrik Lissner
cadc778a03
perf(lib): optimize doom-path
Consecutive expand-file-name and recursive apply's can be expensive, so
the function has been simplified to rely more on file-name-concat. This
does change one trait about it, however: absolute paths in SEGMENTS no
long reroot the whole path, and are concatenated as ordinary file
segments.

The performance benefit is more pronounced on Emacs 28+, and will be
even more so when Doom later starts byte-compiling its libraries.
2022-09-06 22:55:48 +02:00
Henrik Lissner
b68c93d924
refactor: move doom-*-reload-hook to lib/config.el
These hooks are only used by this library, and in interactive sessions,
neither of which make them a good fit for doom.el.
2022-09-06 22:55:47 +02:00
Henrik Lissner
98b8f01de3
fix(lib): vestigial call to missing cat function
This was brought over from `doom-info` in f33d8e7, but one of the
lexical function calls wasn't refactored out.

Ref: a5c80fcb4b/lisp/lib/debug.el (L216-L219)
Fix: #6698
Amend: c5e3f4d632
Co-authored-by: ivanbrennan <ivanbrennan@users.noreply.github.com>
2022-09-06 22:55:45 +02:00
Ivan
b36931dd45
fix(lib): doom-exec-process use doom-print--format
The doom--format function was removed in fe16de6.

Amend: fe16de690418
2022-08-19 11:21:22 +02:00
Henrik Lissner
4c9df9bfc6
fix: partially revert OS detection changes
These changes snuck into ad6a3d0, but have not been implemented yet, so
some OS-specific functionality was orphaned.

Amend: ad6a3d0f33
2022-08-18 17:08:16 +02:00
Henrik Lissner
401a5aa530
refactor(docs): move doom-docs-dir to lib/docs.el
This is not an essential core variable, so it should be defined where it
used, instead.
2022-08-14 20:43:36 +02:00
Henrik Lissner
aa54383b5d
refactor: deprecate doom-etc-dir for doom-data-dir
doom-etc-dir will be renamed to doom-data-dir, to better reflect its
purpose, and align it with XDG_DATA_HOME (where it will be moved to in
v3, where Doom will begin to obey XDG directory conventions more
closely).
2022-08-14 20:43:35 +02:00
Henrik Lissner
a5c80fcb4b
refactor: deprecate doom-private-dir for doom-user-dir
- Deprecates the doom-private-dir variable in favor of doom-user-dir.
- Renames the pseudo category for the user's module: :private -> :user.
- Renames the doom-private-error error type to doom-user-error.

Emacs uses the term "user" to refer to the "things" in user space (e.g.
user-init-file, user-emacs-directory, user-mail-address, xdg-user-dirs,
package-user-dir, etc), and I'd like to be consistent with that. It also
has the nice side-effect of being slightly shorter. I also hope
'doom-user-error' will be less obtuse to beginners than
'doom-private-error'.
2022-08-14 20:43:35 +02:00
Henrik Lissner
ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00
Henrik Lissner
c540f1b515
perf(lib): memoize doom-system-* functions 2022-08-14 20:43:35 +02:00
Henrik Lissner
9c80b33b89
tweak: suppress defvaralias warnings 2022-08-08 18:23:47 +02:00
Henrik Lissner
0f43c3eed5
fix(docs): org-glossary init
- Set org-glossary-global-terms buffer-locally,
- Move org-glossary init into a hook.
- Remove unneeded (require 'ox) (see tecosaur/org-glossary#6),

Ref: tecosaur/org-glossary#6
2022-08-07 19:43:28 +02:00