Commit Graph

273 Commits

Author SHA1 Message Date
9073a5d402 Fix #3610: revert changes to cmd!! macro
Half-reverts e6c88e4384
2020-07-22 17:09:38 -04:00
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
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
8bf902d5f4 General refactors & reformatting across the board 2020-06-04 20:13:28 -04:00
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
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
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
a9316525c4 Backport variadic setq-local from Emacs 27 2020-05-24 16:45:55 -04:00
35b99fb272 Add fn! macro
For cl-function version of lambda, for implicit destructuring of
arguments.
2020-05-20 15:33:55 -04:00
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
f521823d3b Fix quiet! macro not silencing file loading 2020-05-15 01:33:52 -04:00
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
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
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
a2011232a2 Change envvar coding system buffer locally 2020-05-14 04:13:05 -04:00
21fda9af60 Read & write envvar file as utf-8 #3044 2020-05-14 02:54:56 -04:00
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
4a181ebfe8 Revert 7d2876ee0
Didn't fix #3042
2020-05-05 20:14:02 -04:00
7d2876ee00 Prevent coding system prompt during doom commands
Possibly fixes #3042
2020-05-05 16:07:02 -04:00
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
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
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
c3a84f0fbf Reorganize core-lib
Group like macros together.
2020-04-29 20:45:29 -04:00
64b799c68e Load subr-x & cl-lib a little earlier 2020-04-29 20:31:40 -04:00
1442e694fb Move core helpers to core-lib
Since they can be generally useful.
2020-04-29 20:31:40 -04:00
b78fc4eb76 Minor refactor & reformatting across the board 2020-04-08 15:30:10 -04:00
e66769293c Fix potential hashing clashes w/ transient hooks 2020-03-03 18:58:45 -05:00
b8c25b6b4e Move after! to core-lib
Doesn't really belong in core-modules.
2020-01-30 16:57:49 -05:00
14fc65a9fb Remove nconcq! macro
Unused and unnecessary.
2020-01-24 18:14:17 -05:00
d1442a03bf Expand docstring for setq! 2020-01-24 16:38:44 -05:00
522c532893 Correct add-hook!'s docstring 2020-01-20 05:41:42 -05:00
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
5929e5b75a Add undefadvice! macro for rotate-text convenience 2020-01-01 19:34:33 -05:00
a999a0ddd6 General refactors & comment revision 2019-12-19 14:51:34 -05:00
8224f14d92 Expand on lambda!/lambda!!'s docstrings 2019-12-13 14:35:28 -05:00
4bcc9e1a94 Add letenv! macro for lexical envvars 2019-12-08 20:14:11 -05:00
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
b0ac9abfbf Fix add-hook! for hooks that take arguments 2019-10-28 23:23:13 -04:00
f4acb3cefd New add-load-path! convenience macro 2019-10-23 04:24:06 -04:00
e1622142ed Minor, general refactors 2019-10-23 03:57:48 -04:00
ddce674a6c Minor refactors across the board 2019-10-07 16:10:33 -04:00
8527897c88 Remove unused delete! macro
Redundant with delq!
2019-10-06 14:13:30 -04:00
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
ac276bcd3c Correct eldoc signature for {add,remove}-hook! 2019-09-19 13:01:20 -04:00
62b089ba36 Refactor core & core-lib
And make their tests pass
2019-09-03 00:59:46 -04:00
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
8cb1fe1874 Add setq! macro
A convenient alternative to setq where you don't have to care about load
order (no need for after! blocks).
2019-08-27 00:08:22 -04:00
ca574c60b0 Fix pushnew! inserting duplicates of complex types
Because it was using #'eql for comparison, which is insufficient for
compound datatypes, like strings.
2019-08-27 00:05:12 -04:00
a567e2f85e Remove pushmany! macro
It is redundant with prependq!, appendq! and pushnew!.
2019-08-27 00:05:12 -04:00
aff5cc5b28 Move file-exists-p! to core/autoload/files.el 2019-08-22 13:03:12 -04:00