Commit Graph

130 Commits

Author SHA1 Message Date
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
24164f4869 Disable use-package's :ensure t property by default
Many packages recommend setting up their packages with something like:

  (use-package PACKAGE
    :ensure t
    ...)

New users will frequently copy these into their config, then experience
long startup times or a cryptic error about the package failing to
install.

This is because `:ensure t`, by default, uses package.el (Emacs'
built-in package manager) to check for and install packages, but Doom
doesn't use package.el, it uses straight.el. So we disable `:ensure`.

On the other hand, if the user has loaded `package` by hand, then we
should assume that they know what they're doing, and restore the old
behavior.
2020-05-11 16:16:58 -04:00
079b748217 Fix conflict between private & default autodefs
e.g. If you had a ~/.doom.d/modules/tools/lsp/autoload.el that defined
an lsp! autodef, it would be indexed and included in
~/.emacs.d/.local/autoloads.el *before* the lsp! autodef from the
original ~/.emacs.d/modules/tools/lsp/autoload.el.
2020-04-29 18:32:25 -04:00
c51b2d42ad Remove require! macro
This was meant for unit tests, which is where it will be moved to.
2020-04-24 02:35:41 -04:00
38f957557a Remove def-package macros
They've been deprecated for some time now.
2020-04-24 02:35:29 -04:00
1cb753cbb1 lang/haskell: remove intero support
The package was deprecated and abandoned upstream since November 2019.

Closes #2121
2020-04-14 19:27:33 -04:00
a732875ce6 More aggressively deprecate def-package!
It'll be gone soon!
2020-04-08 23:51:40 -04:00
b8c25b6b4e Move after! to core-lib
Doesn't really belong in core-modules.
2020-01-30 16:57:49 -05:00
12094788d7 Fix references to :tools fly{spell,check} 2020-01-14 03:04:26 -05:00
20bc70096f Fix deprecation warnings for fly{check,spell} modules 2020-01-10 22:58:10 -05:00
b89992624b Move :tools fly{check,spell} to :checkers {syntax,spell}
These modules were renamed so we can later generalize their
implementations, such as adding flymake support to the syntax checker.
2020-01-09 22:56:26 -05:00
fe57256d6b Minor refactors; reduce sp-max-prefix-length 2020-01-05 19:58:59 -05:00
ae5cf1889b Move custom-file to {doom-local-dir}/custom.el 2020-01-04 17:10:56 -05:00
0ec1355f13 docs/core: typo in featurep! docs
`s/moduel/module`
2019-12-30 09:35:53 +01:00
322bca710a General refactors & reformatting 2019-12-20 00:59:52 -05:00
235d31e82e Shorten def-package{,-hook}! deprecation warnings 2019-12-03 20:02:32 -05:00
724bf9aa08 Refactor evaluation of doom!'s arguments
And update doom!'s docstring
2019-12-02 20:22:00 -05:00
d11902f313 doom-module-from-path: return nil if not in a module #2107 2019-11-23 14:52:38 -05:00
e0cd71e25f Complain louder about deprecated def-package! macros
They will be removed soon.
2019-10-31 14:35:24 -04:00
f6df219544 Improve error when featurep! can't see current module 2019-10-26 02:13:40 -04:00
ddce674a6c Minor refactors across the board 2019-10-07 16:10:33 -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
03f6b3e77c Consolidate warnings in use-package-hook!'s docstring
Folks commonly abuse this macro. I'd rather they don't, unless they know
exactly what they're doing.
2019-10-01 17:41:25 -04:00
615e632477 Reformat custom use-package keyword config 2019-09-20 23:55:50 -04:00
059ede53b6 Update all unit tests
To meet changes introduced from the straight branch merge.
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
8766499b0d Fix some file permissions errors
Occurs when deferred packages are loaded while in an unreadable or
non-existent directory.
2019-08-27 00:05:12 -04:00
40e6a37652 Expand on doom-module-load-path's docstring
Mention that value in the returned list is always doom-private-dir.
2019-08-21 00:10:24 -04:00
702369e888 Move :ui tabbar to :ui tabs
And update its README.org
2019-08-11 02:05:09 -04:00
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
e6201ca952 Add :if, :when, :unless & :cond support to doom! macro
Now you can conditionally enable/disable modules.
2019-07-26 12:05:13 +02:00
03a4461d3b Indent use-package! the same as use-package 2019-07-24 16:53:33 +02:00
76cacb5bfe 💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00
7ebc9045f2 Fix reference to renamed variable targets 2019-07-23 01:27:20 +02:00
781783fe85 Refactor doom-module-from-path
Now returns (:core) or (:private) for files in doom-core-dir and
doom-private-dir, respectively, and will otherwise return the module for
the current file if called with no arguments.

Also fixes the case where it would disregard arguments and return
whatever the current value of doom--current-module.
2019-07-22 22:34:08 +02:00
457b542795 Fix void-variable next error
And change TARGETS to PACKAGE, which is a more descriptive name.

Mentioned in #374
2019-07-22 18:57:17 +02:00
0c678ee762 Refactor after! macro
The trouble with with-eval-after-load is it arranges for the body to be
byte-compiled, whereas eval-after-load does not. I won't go into how
they do that here, but it causes us some trouble:

Macro calls in with-eval-after-load are eagerly (immediately) expanded
at startup, whether or not the package or macro is available and
regardless of its execution path.

This sucks for Doom because, when expanded, autoloaded macros will be
loaded, along with whatever baggage they've got with them, and this
happens long before they're actually used. We also can't guarantee those
macros are available at startup, which will cause void-function errors
when the interpreter later treats them like an ordinary function call.

So, the simple fix is to pass a quoted body form to eval-after-load
instead of the closure that with-eval-after-load will wrap it in. This
means the body won't get byte-compiled if we compile our config, but in
exchange, macros stay lazy-loaded until they're finally needed!
Wonderful.
2019-07-22 14:49:25 +02:00
b90dede1ab 💥 Replace package.el/quelpa with straight #374
There are a few kinks to iron out, but for the most part it's done. Doom
Emacs, powered by straight. Goodbye gnutls and elpa/quelpa issues.

This update doesn't come with rollback or lockfile support yet, but I
will eventually include one with Doom, and packages will be (by default,
anyway) updated in sync with Doom.

Relevant threads: #1577 #1566 #1473
2019-07-22 02:30:40 +02:00
0a84d2f0a9 core-lib: add auto-minor-mode, revise def-project-mode!
- Adds the auto-minor-mode package to replace our in-house
  implementation.
- Merges associate! into the def-project-mode! macro because associate!
  on its own is less useful than auto-minor-mode-alist,
  auto-minor-mode-magic-alist or hooks.
- Changes the semantics of :modes and :add-hooks properties of
  def-project-mode!. Its arguments are evaluated as is; lists will need
  to be quoted.

squash! core-lib: remove associate! macro
2019-07-22 02:30:39 +02:00
149b2617b0 💥 revise hook/var fns naming convention (2/2)
This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:

1. Replace the bar | to indicate a hook function with a -h suffix, e.g.

     doom|init-ui -> doom-init-ui-h
     doom|run-local-var-hooks -> doom-run-local-var-hooks-h

2. And add a -fn suffix for functions meant to be set on variables,
   e.g.

     (setq magit-display-buffer-function #'+magit-display-buffer-fn)

See ccf327f8 for the reasoning behind these changes.
2019-07-22 02:30:38 +02:00
51d3b1b424 💥 revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.

In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.

  doom*shut-up -> doom-shut-up-a
  doom*recenter -> doom-recenter-a
  +evil*static-reindent -> +evil--static-reindent-a

The rationale behind this change is:

1. Elisp's own formatting/indenting tools would occasionally struggle
   with | and * (particularly pp and cl-prettyprint). They have no
   problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
   github markdown) struggle with it, sometimes refusing to highlight
   code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
   intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
   on haphazardly way back when Doom was simply "my private config".

Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.

Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
  macro. The old pair weren't as useful. The new def-advice! saves on a
  lot of space.
- Removed "stage" assertions to make sure you were using the right
  macros in the right place. Turned out to not be necessary, we'll
  employ better checks later.
2019-07-22 02:27:45 +02:00
71d505b893 Cache doom-modules on doom refresh 2019-07-07 14:10:21 +02:00
faeefc1775 Add FLAG argument to doom-module-p 2019-07-07 14:07:11 +02:00
af7a2d16c4 Clarify argument in after!'s docstring
after! takes a package, not a mode.
2019-07-06 23:22:28 +02:00
cb783b0609 Prevent hash-table-p errors on startup 2019-07-02 23:17:20 +02:00
9a02bd8ac8 Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
b245237b0c Move custom-file to DOOMDIR/init.el
(And don't auto-load it at startup; no need)
2019-06-26 14:31:06 +02:00
5e9c020c21 doom-files-in: replace NOSORT w/ SORT; change default MATCH
- SORT defaults to t
- MATCH's new default regexp excludes files that start with underscore.
2019-06-16 19:16:23 +02:00
efb06ee42f Improve deprecation warnings for modules
Hopefully makes them easier to understand.
2019-05-21 17:24:23 -04:00
2214c3175e Minor tweaks across the board 2019-05-21 00:34:32 -04:00