Commit graph

277 commits

Author SHA1 Message Date
Janfel
3760ceb048
Fix deduplication in add-load-path!
Currently, `add-load-path!` doesn’t check for duplicates in `load-path`, because `cl-pushnew` tests for equality with `eql`. This changes the predicate to `string=`, fixing the bug.
2020-08-07 18:28:36 +02:00
Henrik Lissner
a9bd4965bf
Improve error handling in doom-first-*-hook
This should at least report what function invoked the error.
doom-first-input-hook was especially problematic because it runs on
pre-command-hook, which Emacs is very protective of. It will smother
errors that arise from it and auto-remove the offending hook. This
self-correction is nice for avoiding a broken Emacs, but it makes it
tough to debug those issues.
2020-08-02 18:41:21 -04:00
Henrik Lissner
6ca9e0e2f1
Fix #3632: wrong-number-of-args on setq-local
Emacs 27.0.90 made setq-local variadic. I've backported this in core-lib
for Emacs <27 users. However, there are users who install Emacs
27.0.50...
2020-07-26 14:12:07 -04:00
Henrik Lissner
2441d28ad1
Fix wrong-number-of-args error from cmd!! macro 2020-07-24 18:17:43 -04:00
Henrik Lissner
9073a5d402
Fix #3610: revert changes to cmd!! macro
Half-reverts e6c88e4384
2020-07-22 17:09:38 -04:00
Henrik Lissner
002bf84f45
doom-load-envvars-file: only affect default state
Some plugins (like envrc-mode) make process-environment, exec-path and
shell-file-name buffer-local. Running `M-x doom/reload` or
`doom-load-envvars-file` should affect their global values, and not
their buffer local ones.
2020-06-13 17:01:34 -04:00
Henrik Lissner
5b8b04f0c8
Properly lazy load flyspell
Package was eagerly loaded at startup, so we must pretend it hasn't to
defer it and future configuration.

And generalize defer-feature! macro.
2020-06-05 01:41:49 -04:00
Henrik Lissner
8bf902d5f4
General refactors & reformatting across the board 2020-06-04 20:13:28 -04:00
Henrik Lissner
a9bf0b8985
Add cmd!, cmd!!, cmds! convenience macros
It's kind of silly that our command lambda macros (λ! and λ!!) need a
snippet, special key sequence or copy-paste to insert, so in the spirit
of fn! -- and to make sure they take up less space than `lambda!` --
I've added `cmd!` and `cmd!!` aliases. `lambda!` and `lambda!!` are now
deprecated. λ! and λ!! will remain.

I've also added `cmds!` as a convenience wrapper around
general-predicate-dispatch.
2020-05-27 18:29:35 -04:00
Henrik Lissner
e6c88e4384
Refactor autoloads generator & reduce to one generated file
We no longer need two separate autoloads files, so I merged them and
optimized its generation logic.

Other changes
- Doom will refuse to start up (with a helpful error) if it's in an
  incomplete state. This should hopefully reduce the number of bug
  reports from folks that have done something weird, e.g.
  1. You've changed Emacs versions without running 'doom sync -b'.
  2. You've updated Doom outside of `doom upgrade` and didn't run `doom
     sync -u`.
  3. You've forgotten to run 'doom sync' in the first place!
  4. If a previous 'doom ...' command was aborted midway without running
     'doom sync' afterwards.
- 'doom sync' will emit reminders that you need to reload/restart Emacs
- Autoloads API now uses the `doom-autoloads-` prefix, intead of
  'doom-cli-autoloads-', as will be the new convention in the coming
  rewrite.
- Errors from within the package autoloads should be easier to invoke
  the debugger on.
- `doom-modules` is now stored in your autoloads file. Your module list
  will soon be frozen between calls to 'doom sync' to allow for our new,
  atomic CLI I'm working on. This will also means the `doom!` block
  won't cost anything in interactive sessions.
2020-05-25 15:55:29 -04:00
Henrik Lissner
3a38fc633c
Change doom-{interactive,debug}-mode suffix to -p
Because these are not really modes.

Also makes `doom-debug-mode` an actual (global) minor mode.
2020-05-25 03:43:40 -04:00
Henrik Lissner
a9316525c4
Backport variadic setq-local from Emacs 27 2020-05-24 16:45:55 -04:00
Henrik Lissner
35b99fb272
Add fn! macro
For cl-function version of lambda, for implicit destructuring of
arguments.
2020-05-20 15:33:55 -04:00
Henrik Lissner
ecbd4b7567
Fix setq! not triggering setters
Because the setters were looked up at expansion/compile time (much, much
too early), rather than at runtime.

This should indirectly fix "No year zero" errors for org-journal
users (#3173).
2020-05-20 01:06:04 -04:00
Henrik Lissner
f521823d3b
Fix quiet! macro not silencing file loading 2020-05-15 01:33:52 -04:00
Henrik Lissner
fc90e0fb71
Simplify quiet!'s expanded form
We don't need to test doom-interactive-mode at runtime.
2020-05-15 01:33:52 -04:00
Henrik Lissner
68709fe93a
Fix letf! sometimes losing letf binds
When expanding:

  (quiet! ...)

You'd expect (simplified for explanation):

  (letf! ((standard-output ...)
         ((symbol-function #'message) ...)
         ((symbol-function #'load-file) ...)
         ((symbol-function #'write-region) ...))
    ...)

But instead get:

  (letf! ((standard-output ...))
    ;; where'd the other binds go?
    ...)

This was due to data-loss caused by nreverse's destructive mutation of
the given bindings.

Also: silences byte-compiler complaining about unused bindings.
2020-05-15 01:33:52 -04:00
Henrik Lissner
0e851ace9b
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.

Fixes #2802, #2737, #2386

The big highlights are:

- Fix #2802: We now update recipe repos *before* updating/installing any
  new packages. No more "Could not find package X in recipe repositories".

- Fix #2737: An edge case where straight couldn't reach a pinned
  commit (particularly with agda).

- Doom is now smarter about what option it recommends when straight
  prompts you to make a choice.

- Introduces a new init path for Doom. The old way:
  - Launch in "minimal" CLI mode in non-interactive sessions
  - Launch a "full" interactive mode otherwise.
  The new way
  - Launch in "minimal" CLI mode *only* for bin/doom
  - Launch is a simple mode for non-interactive sessions that still need
    access to your interactive config (like async org export/babel).
  - Launch a "full" interactive mode otherwise.

  This should fix compatibility issues with plugins that use the
  async.el library or spawn child Emacs processes to fake
  parallelization (like org's async export and babel functionality).

- Your private init.el is now loaded more reliably when running any
  bin/doom command. This gives you an opportunity to configure its
  settings.

- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
  deferred activation of a number of packages. Users can remove these
  modes from these hooks; altogether preventing them from loading,
  rather than waiting for them to load to then disable them,
  e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
  'doom-first-buffer #'smartparens-global-mode)

  Hooks added to doom-first-*-hook variables will be removed once they
  run.

  This should also indirectly fix #2386, by preventing interactive modes
  from running in non-interactive session.

- Added `doom/bump-*` commands to make bumping modules and packages
  easier, and `doom/bumpify-*` commands for converting package!
  statements into user/repo@sha1hash format for bump commits.

- straight.el is now commit-pinned, like all other packages. We also
  more reliably install straight.el by cloning it ourselves, rather than
  relying on its bootstrap.el.

  This should prevent infinite "straight has diverged from master"
  prompts whenever we change branches (though, you might have to put up
  with it one more after this update -- see #2937 for workaround).

All the other minor changes:

- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
  simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
  already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
  trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
  doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
  1. Child instances will no longer inherit the process environment of
     the host instance,
  2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-15 01:33:52 -04:00
Henrik Lissner
a2011232a2
Change envvar coding system buffer locally 2020-05-14 04:13:05 -04:00
Henrik Lissner
21fda9af60
Read & write envvar file as utf-8 #3044 2020-05-14 02:54:56 -04:00
Henrik Lissner
24aabfc8e0
Fix #3098: wrong-number-of-args on some interactive closures
It appears key-translation-map keybinds are passed an argument, but
`lambda!` and `lambda!!` produce 0-arity closures.

Closes #3099
2020-05-11 19:46:37 -04:00
Henrik Lissner
4a181ebfe8
Revert 7d2876ee0
Didn't fix #3042
2020-05-05 20:14:02 -04:00
Henrik Lissner
7d2876ee00
Prevent coding system prompt during doom commands
Possibly fixes #3042
2020-05-05 16:07:02 -04:00
Henrik Lissner
2c70b75c6c
Warn user to sync+rebuild on emacs' major version change
Byte-code is not generally compatible across major releases of Emacs,
and packages may have changed in that time. Best throw a more helpful
error than leave users to deal with the obscure errors that this can
cause.
2020-05-03 16:31:06 -04:00
Henrik Lissner
936124e546
Introduce if! & when! macros
The condition argument is evaluated at compile/expansion time, and its
body expanded directly.
2020-04-29 23:48:21 -04:00
Henrik Lissner
d12752324a
Introduce letf! convenience macro
A more succinct cl-letf, which allows for local functions and macros.
2020-04-29 23:48:21 -04:00
Henrik Lissner
c3a84f0fbf
Reorganize core-lib
Group like macros together.
2020-04-29 20:45:29 -04:00
Henrik Lissner
64b799c68e
Load subr-x & cl-lib a little earlier 2020-04-29 20:31:40 -04:00
Henrik Lissner
1442e694fb
Move core helpers to core-lib
Since they can be generally useful.
2020-04-29 20:31:40 -04:00
Henrik Lissner
b78fc4eb76
Minor refactor & reformatting across the board 2020-04-08 15:30:10 -04:00
Henrik Lissner
e66769293c
Fix potential hashing clashes w/ transient hooks 2020-03-03 18:58:45 -05:00
Henrik Lissner
b8c25b6b4e
Move after! to core-lib
Doesn't really belong in core-modules.
2020-01-30 16:57:49 -05:00
Henrik Lissner
14fc65a9fb
Remove nconcq! macro
Unused and unnecessary.
2020-01-24 18:14:17 -05:00
Henrik Lissner
d1442a03bf
Expand docstring for setq! 2020-01-24 16:38:44 -05:00
Henrik Lissner
522c532893
Correct add-hook!'s docstring 2020-01-20 05:41:42 -05:00
Henrik Lissner
fd6def4d5a
Fix letenv! macro
It didn't work due to over-aggressive quoting of the let-vars.
2020-01-01 23:48:36 -05:00
Henrik Lissner
5929e5b75a
Add undefadvice! macro for rotate-text convenience 2020-01-01 19:34:33 -05:00
Henrik Lissner
a999a0ddd6
General refactors & comment revision 2019-12-19 14:51:34 -05:00
Henrik Lissner
8224f14d92
Expand on lambda!/lambda!!'s docstrings 2019-12-13 14:35:28 -05:00
Henrik Lissner
4bcc9e1a94
Add letenv! macro for lexical envvars 2019-12-08 20:14:11 -05:00
Henrik Lissner
99cd52e70f
💥 Drop Emacs 25.x support
Emacs 26.1 is Doom's new minimum supported version

Closes #2026
2019-11-08 16:02:06 -05:00
Henrik Lissner
b0ac9abfbf
Fix add-hook! for hooks that take arguments 2019-10-28 23:23:13 -04:00
Henrik Lissner
f4acb3cefd
New add-load-path! convenience macro 2019-10-23 04:24:06 -04:00
Henrik Lissner
e1622142ed
Minor, general refactors 2019-10-23 03:57:48 -04:00
Henrik Lissner
ddce674a6c
Minor refactors across the board 2019-10-07 16:10:33 -04:00
Henrik Lissner
8527897c88
Remove unused delete! macro
Redundant with delq!
2019-10-06 14:13:30 -04:00
Maximiliano
dea5d84069 Add more api demos (#1845)
* Added function Demos
* Added use-package demos
* Some corrections
* Fix duplicated use-package! type
2019-10-03 14:51:08 -04:00
Henrik Lissner
ac276bcd3c
Correct eldoc signature for {add,remove}-hook! 2019-09-19 13:01:20 -04:00
Henrik Lissner
62b089ba36
Refactor core & core-lib
And make their tests pass
2019-09-03 00:59:46 -04:00
Henrik Lissner
4b736bef68
Introduce doom-interactive-mode
As soft inverse alias for noninteractive; this makes it easier to unit
test functionality that depends on the session type.
2019-09-03 00:37:30 -04:00