Commit Graph

208 Commits

Author SHA1 Message Date
Henrik Lissner
c56f802b4b
Update (if|when)-let* alias comments 2018-12-06 17:45:53 -05:00
Henrik Lissner
7b761a9b42 Refactor feature deferral for (common|emacs)-lisp
'lisp-mode is now deferred, to make it easier to lazy-configure it
2018-12-05 22:11:54 -05:00
Edwin Török
cd314a1188 fix setq-hook error path
In setq-hook!:
core-lib.el:280:41:Warning: ‘listp’ called with 2 args, but requires 1

Signed-off-by: Edwin Török <edwin@etorok.net>
2018-10-04 00:38:05 +01: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
3cd0db82b8 Append setq-hook! hooks
So that later setq-hook! calls will overwrite earlier ones.
2018-09-20 14:31:47 -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
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
Henrik Lissner
59f510e85f
Add four new functions for keywords & file collection 2018-05-19 16:32:12 +02:00
Henrik Lissner
80adb9c1f6
General refactor for consistency & idempotency
Also updated comments
2018-05-18 01:26:41 +02:00
Henrik Lissner
673d3ed147
Prevent duplicate entries in doom-auto-minor-mode-alist 2018-05-16 13:14:46 +02:00
Henrik Lissner
262b2f957b
Fix associate! not enabling minor modes for :files/:modes/:when
Fixes #585
2018-05-16 13:14:46 +02:00
Henrik Lissner
6b8520d189
Change add-transient-hook! to take hook suffix as 2nd arg
By default, transient hooks are defined as doom-transient-hook-N, where
N is a counter. This makes debugging them difficult.

Now, you may specify an id for the second argument. e.g.

  (add-transient-hook! 'find-file-hook load-evil (require 'evil))

Will define doom|transient-hook-load-evil, which is easier to debug and
remove, if necessary.
2018-05-15 21:49:51 +02:00
Henrik Lissner
afdc6a31b5
Move def-setting! macros to core-packages 2018-05-14 13:05:03 +02:00
Henrik Lissner
cef82fe0b0
Minor reorganization of core-lib 2018-05-14 13:05:03 +02:00
Henrik Lissner
57f383ef76
General revision of docstrings 2018-05-14 13:05:03 +02:00
Henrik Lissner
878b413885
New library macro: setq-hook! 2018-05-07 22:35:14 +02:00
Henrik Lissner
035353d295
after!: don't shadow features var 2018-05-07 19:26:31 +02:00
Henrik Lissner
aef9724324
Add doom*shut-up advisor to core-lib 2018-04-23 00:03:28 -04:00
Henrik Lissner
21a23228f2
Refactor initialization; allow package! to universally disable packages
No need for def-package-hook! for disable packages anymore, you can do
it from package! in packages.el files.
2018-03-26 02:57:37 -04:00
Henrik Lissner
5eadfdc880
Add EMACS26+ & EMACS27+ constants 2018-03-24 07:25:00 -04:00
Henrik Lissner
01f9ca9e67
Ensure (if|when)-let* are available to the byte-compiler
This fixes void function errors in earlier versions of Emacs while
byte-compiling Doom.
2018-03-02 19:14:45 -05:00
Henrik Lissner
138ec2bf07
Remove manual loading of pkg-autoloads files
No longer necessary as of 0c80bb42
2018-02-28 17:57:30 -05:00
Henrik Lissner
589108fdb2
Extend after! macro to support :any, :all & feature lists #442 2018-02-28 17:57:30 -05:00
Henrik Lissner
2b1c323dbf
💥 Redesign private sub-module system
~/.doom.d/modules is now a full module tree, like ~/.emacs.d/modules.
Symlinks are no longer involved.

Private modules can now shadow Doom modules. e.g.
~/.doom.d/modules/lang/org will take precendence over
~/.emacs.d/modules/lang/org.

Also, made doom--*-load-path variables public (e.g. doom--site-load-path
=> doom-site-load-path), and rearranged the load-path for a 10-15%
startup boost.
2018-02-16 02:11:10 -05:00
Amos Bird
562d805136
Sensible alias 2018-02-01 14:46:17 +08:00
Henrik Lissner
2f0822ed44
Remove aggressive load of use-package
The autoload in core-packages takes care of it.
2018-01-11 22:18:32 -05:00
Henrik Lissner
7777f9940e
Change add-hook! macro to retain hook order
(add-hook! hook '(1 2 3)) should set hook to `(1 2 3 ,@old-hooks).
Before this, they would be pushed sequentially, resulting in hook =
`(3 2 1 ,@old hooks)`
2018-01-08 14:55:58 -05:00
Henrik Lissner
5cd29479f4
Refactor feature/evil hacks & advice; fix tests 2018-01-07 00:15:57 -05:00
Henrik Lissner
31a4244686
Rethink what Doom loads at startup and manually
Better to simply load what we need, when we need it, rather than set up
autoloads for every litte thing.
2018-01-07 00:15:57 -05:00
Henrik Lissner
0042a56d02
Add new cache library (persistent-soft wrapper) 2018-01-07 00:15:57 -05:00
Henrik Lissner
b28f6ed477
General minor refactor & comment revision 2018-01-06 03:03:02 -05:00
Henrik Lissner
02c14f560d
Refactor bootstrap process + add doom-initialize-load-path 2017-12-22 16:26:05 -05:00
Henrik Lissner
76a4ae459d
Fix obsolete (when|if)-let messages in Emacs 26 2017-12-10 14:49:52 -05:00
Henrik Lissner
4a04406b2b
core-lib: minor refactor; update docstrings+comments 2017-12-09 16:23:19 -05:00
Henrik Lissner
9d3155892a
Rethink how Doom loads core & std libs 2017-12-09 14:41:22 -05:00
Henrik Lissner
07088d3dcf
Removed s.el dependency (prefer built-in) 2017-12-09 14:40:14 -05:00
Henrik Lissner
ff717e5c2f
Refactor quiet! macro 2017-12-03 20:04:00 -05:00
Henrik Lissner
6cb5efc929
core-lib: rename helper fns; move doom-resolve-vim-path
+ doom--resolve-paths => doom--resolve-path-forms
+ doom--resolve-hooks => doom--resolve-hook-forms
+ +evil*ex-replace-special-filenames => doom-resolve-vim-path
2017-09-27 01:23:54 +02:00
Henrik Lissner
546ca0e313
General, minor refactor 2017-09-26 21:55:01 +02:00
Henrik Lissner
5140bb8850
Autoload json library 2017-09-02 16:12:53 +02:00
Henrik Lissner
383d7dbddb
Don't return anything from set! on failure 2017-06-24 17:23:11 +02:00
Henrik Lissner
313fa06400
doom-setting--setter%s => doom--set%s 2017-06-24 16:39:45 +02:00
Henrik Lissner
779ae60454
Refactor doom-resolve-hooks 2017-06-24 16:20:22 +02:00
Henrik Lissner
928812da8a
Make def-setting! behave more like defmacro
set! used to aggressively evaluate its arguments (at expansion-time),
even if placed inside an after! block. This causes unavoidable errors if
those arguments use functions/variables that don't exist yet.

Fixes #112
2017-06-19 00:32:44 +02:00
Henrik Lissner
7d081c3154
Fix subr-x macro autoloads 2017-06-18 23:43:08 +02:00
Henrik Lissner
816df321a5
General refactor & cleanup 2017-06-14 21:15:19 +02:00
Henrik Lissner
07299c5020
core-lib: add doom-quote & doom-enlist 2017-06-12 02:48:26 +02:00
Henrik Lissner
c7254e7bdc
Major optimization refactor, across the board
+ enable lexical-scope everywhere (lexical-binding = t): ~5-10% faster
  startup; ~5-20% general boost
+ reduce consing, function calls & garbage collection by preferring
  cl-loop & dolist over lambda closures (for mapc[ar], add-hook, and
  various cl-lib filter/map/reduce functions) -- where possible
+ prefer functions with dedicated opcodes, like assq (see byte-defop's
  in bytecomp.el for more)
+ prefer pcase & cond (faster) over cl-case
+ general refactor for code readability
+ ensure naming & style conventions are adhered to
+ appease byte-compiler by marking unused variables with underscore
+ defer minor mode activation to after-init, emacs-startup or
  window-setup hooks; a customization opportunity for users + ensures
  custom functionality won't interfere with startup.
2017-06-09 00:47:45 +02:00
Henrik Lissner
baad7953bf
Breaking change: rewrite add-transient-hook!
HOOK is now evaluated. Hooks should be quoted (and functions
sharp-quoted).

This also fixes commit 0150f78e.
2017-06-05 16:43:14 +02:00
Henrik Lissner
db6de01b16 Add doom/describe-{setting,module} 2017-05-28 02:48:20 +02:00
Henrik Lissner
82efbbd3fb Fix void-function async-inject-variables (#81) 2017-05-22 22:32:08 +02:00
Henrik Lissner
ce49f94bbe Remove doom-bootstrap system (will be replaced) 2017-05-20 18:40:13 +02:00