Commit Graph

153 Commits

Author SHA1 Message Date
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
b9c966ec54 Backport to Emacs 25: avoid (setf (alist-get ... 'equal))
We would need to use `'equal` for comparison, but Emacs 25 only allows `'eq`.
Using `advice-add` to override `alist-get` does not work, because `setf`
has special handling for `alist-get`.

`repl.el`: Switch to a hash table which already supports multiple comparison
functions, and changing of elements even in Emacs 25.
`eshell/autoload/settings.el`: use conditional set-or-push.
Drop `doom*alist-get`, it is unused now.

Thanks to @hlissner for the reimplementation.
2018-09-12 23:03:02 +01:00
Henrik Lissner
5b807a1c72
Fix alist-get polyfill's use of assoc in Emacs 25
assoc has only two arguments in Emacs 25, but the polyfill was using its
third argument.

This was discussed in #875
2018-09-10 12:48:19 -04:00
Henrik Lissner
be29623f0d
Reorganize doom core-lib & reformat autoload/ui.el
+ Move doom-files-in to autoload/files.el
+ Move doom*shut-up to autoload/ui.el
+ Reorganize autoload/ui.el
2018-09-09 09:58:19 -04:00
Henrik Lissner
7d3ffdff06
Remove third line in section headers
This is truly important stuff. We've saved many lives with this update.
2018-09-09 09:58:19 -04:00
Henrik Lissner
e290c6e03b
Minor refactor of associate!'s initializer 2018-08-11 01:59:37 +02:00
Henrik Lissner
80eb1dc449
Fix file-exists-p! with nested forms
Due to the eval not picking up lexical bindings.
2018-08-03 02:46:48 +02:00
Henrik Lissner
7b881c771a
doom-files-in: fix default :match to ignore dotfiles 2018-07-30 03:49:37 +02:00
Henrik Lissner
4941e327f4
General refactor for readability
+ Removes redundant/unhelpful comments
+ Renames functions, hooks and variables to be self-documenting
+ Use add-to-list to ensure idempotency (and is more performant)
2018-07-09 15:33:31 +02:00
Henrik Lissner
e76e4a1f75
Fix void-variable errors from defer-until! macro 2018-06-28 14:40:11 +02:00
Henrik Lissner
07d37f97fb
Refactor after! macro
KISS
2018-06-27 22:46:49 +02:00
Henrik Lissner
5a7c8803d9
Remove :when support from after!; add defer-until!
New macro does what the :when keyword did for after!.
2018-06-27 21:29:28 +02:00
Henrik Lissner
5ae25318a4
Remove fmakunbound from add-transient-hook!
unintern is enough.
2018-06-27 18:53:05 +02:00
Henrik Lissner
79e155a2a8
doom-files-in: match full path with :match
Instead of just the filename.
2018-06-26 18:58:07 +02:00
Henrik Lissner
e91af20003
Optimize core-lib & pure module functions
And confer module membership check to run-time, rather than compile
time.
2018-06-24 22:23:08 +02:00
Henrik Lissner
f6dc6ac74e
Refactor out map.el usage
After some profiling, it turns out map-put and map-delete are 5-7x
slower (more on Emacs 25) than delq, setf/alist-get and add-to-list for
small lists (under 250 items), which is exactly how I've been using
them.

The only caveat is alist-get's signature is different on Emacs 25, thus
a polyfill is necessary in core-lib.
2018-06-23 19:53:54 +02:00
Henrik Lissner
5cb1d5d4c9
eval-after-load -> with-eval-after-load
The way Doom was using eval-after-load ensured its form were never
byte-compiled or even checked by the byte-compiler, because they were
treated as quoted forms (data), and thus eval'ed.

Friends don't let friends use eval.
2018-06-20 02:08:34 +02:00
Henrik Lissner
151858a8dc
Redesign Doom error handling
Another refactor, again to improve the locality of doom errors and make
the data that accompanies them more useful in determining the origin and
source of issues. Also, bin/doom is now a little more informative about
how to debug errors.
2018-06-20 02:07:12 +02:00
Henrik Lissner
126b7b6383
Refactor associate! with cl-defmacro 2018-06-16 11:34:42 +02:00
Henrik Lissner
2047a52fcd
Refactor add-transient-hook!
Use gensym instead of counter (and unintern the function symbol after
it's been used).
2018-06-15 23:54:07 +02:00
Henrik Lissner
8e6519ef1a
Fix & refactor after!'s :when keyword support
It no longer tries to load keywords (like :when and :any) as packages,
and won't treat :when's arguments as a require target.
2018-06-15 23:53:58 +02:00
Henrik Lissner
3c7c5d5120
Move doom-file-cookie-p to core-dispatcher
And rename it to doom--file-cookie-p
2018-06-15 16:20:20 +02:00
Henrik Lissner
2496e0348d
Add :when support to after!
This lets you delay a body of code until an arbitrary condition is
met (which is checked whenever a file is loaded).

Also refactors set-file-template! to wait until +file-templates-alist is
defined.
2018-06-15 03:42:01 +02:00
Henrik Lissner
399591b951
Add :mindepth property to doom-files-in
+ don't error out if directory doesn't exist.
+ :depth now starts from 0, instead of 1
2018-06-12 21:07:34 +02:00
Henrik Lissner
fe6afa19a3
Add docstrings to FILE! & DIR! macros 2018-06-12 00:25:11 +02:00
Henrik Lissner
0741c8851a
Split core-packages into two (packages & modules)
+ Move doom-initialize et co into core.el
+ Lazy load core-packages
+ load! has been moved into core-lib
+ Added FILE! and DIR! macros
+ Fix package! not returning correct value when package is disabled
+ Remove :disabled support for def-package-hook! officially
2018-06-12 00:02:04 +02:00
Henrik Lissner
dd2d704137
Fix reference to renamed _directory variable
Whoops!
2018-06-08 13:39:04 +02:00
Henrik Lissner
bc2f8a0ec9
Don't complain about used _directory letvar
Byte-compiler-sama must be appeased.
2018-06-08 13:30:20 +02:00
Henrik Lissner
dda81f7b54
Fix insertion order of add-hook! when appending
When appending multiple functions to a hook(s) with add-hook!, insertion
order was not preserved. e.g.

  => (add-hook! :append 'some-mode-hook #'(hook-1 hook-2))
  => some-mode-hook
  (hook-2 hook-1)
2018-06-07 02:51:45 +02:00
Henrik Lissner
c96086d426
Fix reference to void variable path
In certain uses of file-exists-p! and project-file-exists-p!
2018-06-04 21:17:49 +02:00
Henrik Lissner
52a04fd8c6
Optimize file-exists-p! & project-file-exists-p! 2018-06-04 21:17:49 +02:00
Henrik Lissner
b53df20dd5
Minor refactor of associate! macro 2018-06-03 23:56:25 +02:00
Henrik Lissner
796af69c28
Move define-key! macro to core-lib 2018-06-03 23:52:21 +02:00
Henrik Lissner
e5a4415d58
General, minor reformatting/refactor 2018-06-02 13:58:04 +02:00
Henrik Lissner
a4d03654bd
Fix associate!'s :files refusing a list of strings
Due to changes under the hood, the :files FORM property requires FORM to
either be a nested form of and/or sexps, or a single string. This is
inconsistent with the plurality of ":files", so it has been fixed to
accept a list of strings (with an implicit (and ...)).
2018-05-31 16:59:53 +02:00
Henrik Lissner
c0b904afca
Fix void-variable nose-mode error in python #628
Caused by associate! only doing a fboundp check on MODE, but not boundp,
before trying to access its value.
2018-05-30 16:05:24 +02:00
Henrik Lissner
6b1e1a2c58
Fix doom-files-in returning files in arbitrary order
This would cause compilation issues in doom//byte-compile because
prerequisite files weren't compiled before dependent ones.
2018-05-30 01:43:57 +02:00
Henrik Lissner
4863f9fbf0
Fix after! macro with multiple features 2018-05-28 17:31:44 +02:00
Henrik Lissner
9e7703db2a
core-lib (add-transient-hook!): set permanent-local-hook on hook fn 2018-05-24 22:35:45 +02:00
Henrik Lissner
3dd291a675
core-lib: improve function docstrings 2018-05-24 21:15:17 +02:00
Henrik Lissner
4ee0b5ba6d
New macros file-exists-p! & project-file-exists-p!
The latter replaces the doom-project-has! macro
2018-05-24 21:15:17 +02:00
Henrik Lissner
b2186745b7
Refactor doom--resolve-path-forms 2018-05-24 18:35:06 +02:00
Henrik Lissner
a48f75371b
core-lib (doom-files-in): default relative-to to default-directory 2018-05-24 13:02:20 +02:00
Henrik Lissner
dc0175b8e1
Merge doom-files-under into doom-files-in; more powerful doom-files-in 2018-05-23 23:34:32 +02:00
Henrik Lissner
2637c415d3
Add error checks & docstrings to doom-keyword-* lib functions 2018-05-23 19:09:09 +02:00
Henrik Lissner
67269fdf2b
add-transient-hook!: unintern => fmakunbound 2018-05-21 01:38:17 +02:00
Henrik Lissner
ac5eaf0fb3
Load core-lib before core-package
So that core-package may use the Doom standard library.
2018-05-21 01:38:17 +02:00
Henrik Lissner
16a9126b3e
Make after! noop if package is disabled
After disabling a package, def-package! blocks for that package are
ignored. Now, after! blocks for those packages will be ignored too.
2018-05-21 01:38:17 +02:00
Henrik Lissner
dc4e0f1556
Add doom-file-cookie-p to core-lib 2018-05-20 00:07:06 +02:00
Henrik Lissner
fa37d7b05e
Refactor core initialization process
A vastly simpler bootstrap process.

Also load core libs in core-lib (duh)
2018-05-19 16:42:48 +02:00