Commit graph

313 commits

Author SHA1 Message Date
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
a567e2f85e
Remove pushmany! macro
It is redundant with prependq!, appendq! and pushnew!.
2019-08-27 00:05:12 -04:00
Henrik Lissner
aff5cc5b28
Move file-exists-p! to core/autoload/files.el 2019-08-22 13:03:12 -04:00
Henrik Lissner
856a2afe43
Add delete! convenience macro
And polish delq!'s docstring.
2019-08-11 02:05:09 -04:00
Henrik Lissner
87358db85e
Fix void-function mapcan on Emacs 25.x 2019-08-07 16:54:47 -04:00
Daniel Koning
2d28808121 Correct argument name in `defadvice!' docstring 2019-08-05 18:27:56 -05:00
Henrik Lissner
99c73cea0b
setq-hook!: don't append setq hooks
Now settings can take effect in time for hooks that could see them.
2019-07-29 21:09:23 +02:00
Henrik Lissner
3c36a345d8
Fix file! not returning filename in some cases
There are scenarios where load-file-name is set, but load-in-progress is
not. It is safe to assume the value of load-file-name is always what we
want.

Also: file! now throws an error if it can't find the directory.
Otherwise we have to deal with roundabout errors from other places that
expect file! to never fail.
2019-07-27 17:00:12 +02:00
Henrik Lissner
a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00
Henrik Lissner
a146e61728
Remove DIR!, FILE! and def-advice! obsolete aliases 2019-07-26 03:12:07 +02:00
Oleksii Filonenko
62741a4214
Remove quoting in λ!! 2019-07-25 20:50:54 +03:00
Henrik Lissner
b8837ac022
Fix keyword type check in doom-keyword-name 2019-07-24 15:26:43 +02:00
Henrik Lissner
d55f284386
Refactor file-exists-p macro
And refactor too doom--resolve-path-forms
2019-07-23 20:43:24 +02:00