Commit Graph

47 Commits

Author SHA1 Message Date
Henrik Lissner
3ed54e191b
Fix #1322: replace load-env-vars w/ custom loader
I've replaced load-env-var with our own custom parser. load-env-var
expects a well-formatted env file, which neither env nor set produces,
which is what doom env uses to dump the shell environment.

This should fix issues that arise when envvars (like PATH) contain
arbitrary whitespace.
2019-05-17 20:19:35 -04:00
Henrik Lissner
2cb5d895d7
cli/upgrade: fix void-function error
Derpity derp derp.

Derp McDerpington.

Derpsville, population me.
2019-05-15 17:29:43 -04:00
Henrik Lissner
4b66b7c29b
cli/upgrade: emit full error, if one occurs 2019-05-15 17:17:56 -04:00
Henrik Lissner
f7a6b2b33e
cli/upgrade: refresh before updating packages
So missing packages are installed and orphaned ones are removed (and env
file updated, if necessary).
2019-05-14 23:41:02 -04:00
Henrik Lissner
f0fe71892b
cli/upgrade: autoremove orphaned packages 2019-05-14 22:30:16 -04:00
Henrik Lissner
7443669b1e
Minor refactors & comment revision 2019-05-13 14:37:00 -04:00
Henrik Lissner
2358dbfc84
Replace "Doom" w/ ~/.emacs.d when 'upgrade' fails 2019-05-12 00:56:17 -04:00
Henrik Lissner
a558f9b3f1
cli/quickstart: fix font path for all-the-icons-install-fonts
all-the-icons-install-fonts guesses the font path based on
`window-system', which is nil in tty Emacs.
2019-05-12 00:56:17 -04:00
Henrik Lissner
d7bc99c3c3
Add deprecation warnings to doom patch-macos
And make "doom env enable" an alias for "doom env auto"
2019-05-09 18:43:32 -04:00
Henrik Lissner
e0e82ffbeb
cli/quickstart: ensure new init.el doom! is seen 2019-05-06 02:12:49 -04:00
Henrik Lissner
e75c41b10d
Fix autoload/hydras.el autoloads #1388
Caused by autoloads paths not being resolved correctly during
generation.
2019-05-05 19:40:51 -04:00
Henrik Lissner
45266213a5
Revert 087127a3
Installing buttercup on demand wasn't robust enough. Tests were breaking
more often.
2019-05-05 00:02:59 -04:00
Henrik Lissner
eb47568701
cli/quickstart: generate {init,config,packages}.el separately
Instead of aborting if DOOMDIR exists, all three files will be
checked (and generated) separately.
2019-05-01 21:02:29 -04:00
Henrik Lissner
6d314c2795
Revise and update docstrings and comments 2019-05-01 21:02:28 -04:00
Henrik Lissner
6bd6c1623b
Fix 'doom upgrade' not updating pkg autoloads
Folks should no longer need to run 'doom refresh' after upgrading.
2019-04-30 18:44:44 -04:00
Henrik Lissner
087127a31d
Lazy-install buttercup package 2019-04-29 18:48:35 -04:00
Henrik Lissner
88406bb11a
Fix unit test runner 2019-04-24 18:16:07 -04:00
Henrik Lissner
defd60b24b
Fix doom quickstart not installing packages
If the user had no ~/.doom.d/init.el to begin with, and never reads it
after it's been created (by `doom quickstart`), then Doom can't possibly
know what modules to install packages for, therefore no packages get
installed!
2019-04-09 03:31:05 -04:00
Henrik Lissner
2b7c215aee
Refactor byte-compile dispatchers
And don't implicitly compile ~/.emacs.d/init.el unless :core (or no
args) are passed.
2019-04-06 00:11:32 -04:00
Henrik Lissner
5be0e2be4a
Omit private module on doom compile
The private module won't be byte-compiled implicitly anymore, as it can
cause unexpected problems with stale code and config portability.

doom compile          -> only compiles ~/.emacs.d
doom compile :core    -> ~/.emacs.d/core
doom compile :plugins -> ~/.emacs.d/.local/packages/elpa
doom compile :private -> ~/.doom.d
2019-04-05 03:19:38 -04:00
Henrik Lissner
700cda370b
Refactor doom env
- Limits process-environment during scraping
- Add `doom-env-executable` and `doom-env-switches` variables
- Announce what commands were run to produce your env var within env var
  file header
2019-04-03 00:09:22 -04:00
Henrik Lissner
7b8a2fcff8
Don't capture INSECURE, DEBUG & YES envvars
They should be transient.
2019-03-28 14:47:31 -04:00
Henrik Lissner
af37f9af58
Fix wrong-number-args error on doom env 2019-03-28 13:30:39 -04:00
Henrik Lissner
9b97631ddf
Fix typo in env file template 2019-03-28 02:25:28 -04:00
Henrik Lissner
2f0ad0e269
Fix -y/--yes/YES in doom quickstart 2019-03-28 02:24:19 -04:00
Henrik Lissner
2dc52bc9be
💥 Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.

Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
  commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)

The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.

+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
  running `doom env enable` (`doom env clear` will reverse this and
  delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
  file. You won't need it if you're confident Emacs will always be
  started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
  doom/reload-env`. Note: this won't work if the Emacs session you're
  running it in doesn't have a correct SHELL set. i.e. don't use this to
  create your first env file!

The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.

This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 01:56:09 -04:00
Henrik Lissner
7fd1497e88
Ask to install all-the-icons fonts in doom quickstart 2019-03-16 23:59:50 -04:00
Henrik Lissner
a443d9ab07
Refactor doom-initialize-packages & package API
- Packages are initialized once, when package.el is first loaded, and
  must be updated manually via doom/reload-packages.
- Package->module association is now stored in the package's PLIST under
  :modules. This is an internal property and cannot be explicitly set
  through `package!'
- Add doom-package-list function
- Rename doom-get-packages to doom-find-packages
- Updated doom-find-packages' docstring
- Added the :core filter to doom-find-packages
- Simplified doom-initialize-packages
- doom/reload calls doom/reload-packages if necessary.
- Fix redundant properties in doom-packages
- Remove tracking of after!, def-package! and def-package-hook! blocks.
  Replaced with doom-package-list being able to see all packages, even
  in disabled modules.
- Add :built-in property to package! for dummy packages. This is
  important so that doom/describe-package can see built-in packages.
2019-03-08 04:25:44 -05:00
Henrik Lissner
9b180fda97
Refactor doom-initialize & bootstrap in core.el 2019-03-08 02:37:32 -05:00
Henrik Lissner
8a90f29c91
Make session persistence module agnostic
They've been removed from feature/workspaces and moved into
core/autoload/sessions, which falls back to desktop.el if persp-mode
isn't present. This also offers a substantial speed up to
restart+restoring and restoring sessions in general.

Also fixes #1210, where the newly spawned frame after doom/restart
wasn't focused.

Introduces the following commands:

- doom/restart
- doom/restart-and-restore
- doom/quickload-session
- doom/quicksave-session
- doom/load-session
- doom/save-session
- +workspace/restore-last-session (alias for doom/quickload-session)

And removes

- +workspace/load-session
- +workspace/save-session
- +workspace/load-last-session (renamed to +workspace/restore-last-session)
- +workspace/restart-emacs-then-restore (replaced by doom/restart-and-restore)
- :ss (ex command)
- :sl (ex command)
2019-03-02 01:34:19 -05:00
Henrik Lissner
8903eebdc4
Change purpose of autodef cookie argument
;;;###autodef FORM

FORM was used as a predicate for inclusion as an autodef. Now it is used
as the replacement sexp in case the module is disabled.

Oh, you don't know what autdefs are? Well let me explain (thanks for
asking, by the way). An autdef'ed function, macro, or function alias is
always available to be called, anywhere in Doom, even if its containing
module is disabled. For instance:

  ;;;###autodef
  (defun say-hello! (name)  ; the trailing ! denotes an autodef
    (message "Hello %s" name))

This makes it safe to call `do-something` without a check whether it
exists (or if its module is enabled). When the module is enabled, an
autoload entry is added to the Doom autoloads file:

  (autoload 'do-something "path/to/some/modules/autoloads")

And it is autoloaded as normal when it is first used. However, if the
module is disabled, then this is inserted instead:

  (defmacro do-something (&rest _))

This no-ops; it does nothing and doesn't evaluate its arguments. If FORM
above was provided, that is used instead of a noop macro.

It's a little smarter than simple substitution, but that's the gist of
it.
2019-03-02 01:34:14 -05:00
Henrik Lissner
31a0ad5b95
Move doom--condition-case! to core/cli/packages
The only place it is being used
2019-01-10 15:44:42 -05:00
Henrik Lissner
232cb190cc
Mention alternative in docs for bin/doom upgrade 2019-01-05 15:33:06 -05:00
Henrik Lissner
78ebec77ce
Update packages after bin/doom upgrade 2019-01-02 13:56:13 -05:00
Henrik Lissner
b5552eed39
Improve predicate fn for byte-compile targets
Will now avoid dotfiles and unit test files.
2018-12-06 17:45:53 -05:00
Henrik Lissner
847983e278
Fix bin/doom hanging after generating autoloads
Emacs occasionally hangs when polling for the emacs server (with
server-running-p). Since this is used for such a trivial feature (to
decide whether or not to display the "you need to restart" message), I
removed it. Now it always shows that message (if the autoload files have
changed).
2018-10-19 12:07:17 -04:00
Henrik Lissner
9a17c909c9
Don't always create dummy files on doom quickstart
Only when DOOMDIR doesn't exist.
2018-10-06 20:44:25 -04:00
Henrik Lissner
e85aaabed9
Rewrite bin/doom quickstart
Now creates a packages.el file as well, with some commented examples,
and includes comment headers for config.el and packages.el.
2018-09-30 22:49:23 -04:00
Henrik Lissner
15991b5639 Refactor quiet! to be less destructive
It's possible for the debugger to be invoked from inside code wrapped in
a (quiet! ...) call. The debugger pauses Emacs in a broken state where
the functions locally rebound by quiet! (e.g. message, load-file,
write-region, etc) are never returned to their original definitions.

This attempts to reduce that probabilityby changing how quiet! silences
code. Rather than silencing them completely, they will be logged
to *Messages* but not displayed in the echo area.

Also, quiet! is now used less, where it isn't strictly needed (or where
inhibit-message is sufficient).
2018-09-28 21:13:27 -04:00
Henrik Lissner
377dbae3fc
Install/compile packages in order of declaration
This should fix an issue where a package A, which uses macros from a
package B, is installed before package B, causing void-function errors.

The currently known and affected packages are neotree, parinfer, and
evil-collection.
2018-09-25 11:00:30 -04:00
Henrik Lissner
a9fdeefe15
Revert 142d364
Only add doom-private-dir to load-path during autoload generation,
otherwise a $DOOMDIR/autoload.el will shadow the built-in autoload.el
Emacs package.

Note: with `doom-private-dir' in `load-path', Doom autoloads files will
be unable to declare autoloads for the built-in autoload.el Emacs
package, should $DOOMDIR/autoload.el exist. Not sure why they'd want to
though, so it's an acceptable compromise for simpler autoload
declarations.
2018-09-14 09:39:40 -04:00
Henrik Lissner
bd39ff3526
Minor reformatting 2018-09-13 19:15:16 -04:00
Edwin Török
8f5d822363 make compile-core: fix warnings
It is easier to spot real problems if the code is warning-free.

Replacing `gensym` with `make-symbol` is an idea taken from here:
b44c08dd45

In defer-until!:
core-lib.el:150:19:Warning: function ‘gensym’ from cl package called at
    runtime

In add-transient-hook!:
core-lib.el:216:16:Warning: function ‘gensym’ from cl package called at
    runtime

In toplevel form:
autoload/message.el:35:1:Warning: Unused lexical variable ‘spec’

In toplevel form:
autoload/line-numbers.el:31:1:Warning: defcustom for
    ‘display-line-numbers-type’ fails to specify containing group
autoload/line-numbers.el:31:1:Warning: defcustom for
    ‘display-line-numbers-type’ fails to specify containing group
autoload/line-numbers.el:39:1:Warning: defcustom for
    ‘display-line-numbers-grow-only’ fails to specify containing group
autoload/line-numbers.el:39:1:Warning: defcustom for
    ‘display-line-numbers-grow-only’ fails to specify containing group
autoload/line-numbers.el:44:1:Warning: defcustom for
    ‘display-line-numbers-width-start’ fails to specify containing group
autoload/line-numbers.el:44:1:Warning: defcustom for
    ‘display-line-numbers-width-start’ fails to specify containing group

In toplevel form:
cli/autoloads.el:137:1:Warning: Unused lexical variable ‘type’

Preserve name of unused lexical var _type

Makes it obvious what is stored there.
2018-09-12 23:03:23 +01:00
Edwin Török
575c3cccd9 make compile: exit with non-zero code on error
This would allow the CI to fail to compilation errors.
2018-09-12 22:55:13 +01:00
Henrik Lissner
41743869af Fix -y option for bin/doom compile #875 2018-09-09 16:44:17 -04:00
Henrik Lissner
4d10c28c37
Change doom-ansi-apply, print! & format!
Color let-functions no longer take format string arguments. e.g.

  (format! (red "Hello %s" "world"))

Becomes

  (format! (red "Hello %s") "world")

The same goes for print!. Also, doom-ansi-apply now takes two arguments
instead of three.

Also merges doom-message-{fg,bg,fx} into doom-ansi-alist, and reduces
backtrace noise when errors originate from inside these macros.
2018-09-09 09:58:20 -04:00
Henrik Lissner
77d2d84e14
Refactor core-cli
Moved to separate files for better organization.
2018-09-09 09:58:20 -04:00