Commit graph

295 commits

Author SHA1 Message Date
Henrik Lissner
628f0a930f Force straight to byte-compile packages in same session
Straight (on its develop branch) byte compiles packages in a child
process, isolated from the current session. This is a sensible approach
and I applaud it, but there's a problem:

Some packages don't load their compile-time dependencies at
compile-time, causing errors *at* compile-time. They unwittingly rely on
the fact that package.el compiles them in the same session as their
dependencies, which indirectly loads their macros for them. I can't
depend on package authors to do the right thing, but I can force
straight to revert to the old approach.
2021-02-05 22:48:31 -05:00
Henrik Lissner
f5a9dc11ee Update deprecated notices on back (+forward) ports 2021-01-31 04:30:48 -05:00
Henrik Lissner
b91f1607d8 Fix #4532: wrong-number-of-args errors on emacs HEAD
This is a temporary fix. These should be removed once packages have
updated to accommodate the changes to the
define-obsolete-{variable,function,face}-alias macros.
2021-01-31 04:30:48 -05:00
Henrik Lissner
20e74206a8
Merge pull request #4531 from jbampton/fix-spelling
Fix spelling
2021-01-27 02:36:44 -05:00
Henrik Lissner
63929a240c Fix doom-lookup-key
+ Scanning wrong variable for minor mode keymaps (minor-mode-alist ->
  minor-mode-map-alist).
+ Accommodate possibility that emulation-mode-map-alists may contain
  nested alists (#4538).

Closes #4538
2021-01-18 17:45:29 -05:00
John Bampton
583f854298 Fix spelling 2021-01-18 02:16:45 +10:00
Henrik Lissner
da177d58c4
Fix #4457: wrong-type-arg keymapp on C-i keybinds 2021-01-05 01:55:53 -05:00
Henrik Lissner
a567834ff8
Fix #4457: broken key sequences ending with C-i 2021-01-03 22:40:06 -05:00
Henrik Lissner
c987794884
Fix #4478: backport exec-path function from 27.1 2021-01-03 17:40:33 -05:00
Henrik Lissner
4281a772b1
Revise core lib docstrings for clarity 2020-12-11 17:38:59 -05:00
Henrik Lissner
8edabbecfa
Add kbd! alias for general-simulate-key macro 2020-12-11 16:59:47 -05:00
Henrik Lissner
b5e948054c
Refactor & reformat core.el
Backport a bit of core.el from our CLI rewrite.
2020-12-02 17:58:09 -05:00
Henrik Lissner
affd076d53
Minor refactors & reformatting 2020-12-01 13:53:46 -05:00
Akira Baruah
c3001f77aa core-lib: Add docstring for add-hook-trigger! 2020-11-19 00:31:13 -08:00
Henrik Lissner
65be6923e7
Fix wrong-number-of-args on 'doom install'
Only affects Emacs 26.x users, because `file-name-quote`s signature
changed in 27.1.
2020-11-02 17:02:10 -05:00
Henrik Lissner
7ec623593e
Fix magit in remote repos
And backport executable-find from Emacs 27.1 so we don't have to do
these version checks every time we use it.
2020-11-02 14:43:12 -05:00
Henrik Lissner
b461f76b0d
Fix *-local-vars-hook & doom-first-*-hook not triggering
When starting Emacs with a file path argument these hooks aren't set up
in time for the file to be processed.

Fixes #3891, #4082, #4104
2020-10-16 23:08:56 -04:00
Henrik Lissner
518c97a2ac
Rename {if,when}! -> eval-{if,when}!
To better represent its purpose, as extensions to Emacs' eval-when*
API (for control flow at compile time).
2020-08-27 01:10:08 -04:00
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