Commit Graph

181 Commits

Author SHA1 Message Date
Henrik Lissner
4cde9afd93
Refactor setq-hook!
Simplifies its expanded form and names the hook function to make the
hook's value more readable in help buffers.
2019-05-19 02:17:58 -04:00
Henrik Lissner
81a054deda
Add custom-set-faces! convenience macro
For setting face attributes non-destructively. See docstring for usage
example.
2019-05-18 16:46:21 -04:00
Henrik Lissner
c6ceb147e6
doom-log: show source module before message 2019-05-15 15:22:09 -04:00
Henrik Lissner
7443669b1e
Minor refactors & comment revision 2019-05-13 14:37:00 -04:00
Henrik Lissner
c42600d771
Fix void-variable sym errors
And remove trailing hyphen on anonymous transient hooks.
2019-05-05 00:01:52 -04:00
Henrik Lissner
7f004f321a
Optimize set-transient-hook!
In case HOOK-OR-FUNCTION is an expensive lisp form.
2019-05-04 19:13:26 -04:00
Henrik Lissner
388e0def2c
Cheer up the byte-compiler
You deserve better than those warnings.
2019-05-02 21:54:47 -04:00
Henrik Lissner
6d314c2795
Revise and update docstrings and comments 2019-05-01 21:02:28 -04:00
Henrik Lissner
25a86c18c8
Fix quiet! not returning BODY's return value 2019-04-19 13:30:39 -04:00
Henrik Lissner
742687a51e
Add delq! and pushnew! macros
And move projectile configs to their respective modules (and out of
package configs).
2019-04-08 23:01:30 -04:00
Henrik Lissner
a258995db9
Set arglist to add-hook!/remove-hook! macros
More sensible eldoc support.
2019-03-10 08:15:46 -04:00
Henrik Lissner
e0ed8669af
Move (if|when)-let* shims to core.el
Fix void-functon when-let* errors at startup for Emacs 25.* users.
2019-03-08 18:06:35 -05:00
Henrik Lissner
748b197676
Minor, general refactors 2019-03-08 04:25:45 -05: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
8f2fb07948
Add advice-add! & advice-remove! helpers 2019-03-08 02:37:33 -05:00
Henrik Lissner
9b180fda97
Refactor doom-initialize & bootstrap in core.el 2019-03-08 02:37:32 -05:00
Henrik Lissner
2d353b849c
Change file-exists-p! to return file if it exists 2019-03-08 02:34:26 -05:00
Henrik Lissner
cfa97470fc
Add links to config files in describe-packages
Also dims packages that aren't installed.
2019-03-05 01:55:40 -05:00
Henrik Lissner
cf5a398e0d
doom-log: include doom-debug-mode test in result
Relevant to #1215
2019-03-05 00:19:51 -05:00
Henrik Lissner
f6cc2644b0
New doom-log macro for debug-time logging
doom-log won't interfere with the minibuffer if it's in use, and will
report the originating module.

Addresses #1215
2019-03-04 18:38:25 -05:00
Henrik Lissner
6fd34cd10f
Revise documentation for defer-feature! macro 2019-02-24 20:59:29 -05:00
Henrik Lissner
674ad9837d
Update after! docstring 2018-12-22 04:25:15 -05:00
Henrik Lissner
4daa9271a0
Introduce general.el & rewrite map!
+ Now uses an overriding keymap for leader keys, so that it is always
  available, even outside of normal/visual states. In insert/emacs
  states, or in sessions where evil is absent, an alternative prefix is
  used for leader/localleader keys. See these variables:
  + doom-leader-prefix
  + doom-leader-alt-prefix
  + doom-localleader-prefix
  + doom-localleader-alt-prefix
+ Keybinds now support alternative prefixes through the new :alt-prefix
  property. This is useful for non-evil users and non-normal evil
  states. By default, this is M-SPC (leader) and M-SPC m (localleader).
+ Removed +evil-commands flag from config/default (moved to
  feature/evil/+commands.el).
+ config/default/+bindings.el has been split into
  config/default/+{evil,emacs}-bindings.el, which one is loaded depends
  on whether evil is present or not. The latter is blank, but will soon
  be populated with a keybinding scheme for non-evil users (perhaps
  inspired by #641).
+ The define-key! macro has been replaced; it is now an alias for
  general-def.
+ Added unmap! as an alias for general-unbind.
+ The following modifier key conventions are now enforced for
  consistency, across all OSes:
    alt/option      = meta
    windows/command = super
  It used to be
    alt/option      = alt
    windows/command = meta
  Many of the default keybinds have been updated to reflect this switch,
  but it is likely to affect personal meta/super keybinds!

The map! macro has also been rewritten to use general-define-key. Here
is what has been changed:

+ map! no longer works with characters, e.g. (map! ?x #'do-something) is
  no longer supported. Keys must be kbd-able strings like "C-c x" or
  vectors like [?C-c ?x].
+ The :map and :map* properties are now the same thing. If specified
  keymaps aren't defined when binding keys, it is automatically
  deferred.
+ The way you bind local keybinds has changed:

    ;; Don't do this
    (map! :l "a" #'func-a
          :l "b" #'func-b)
    ;; Do this
    (map! :map 'local "a" #'func-a
                      "b" #'func-b)

+ map! now supports the following new blocks:
  + (:if COND THEN-FORM ELSE-FORM...)
  + (:alt-prefix PREFIX KEYS...) -- this prefix will be used for
    non-normal evil states. Equivalent to :non-normal-prefix in general.
+ The way you declare a which-key label for a prefix key has changed:

    ;; before
    (map! :desc "label" :prefix "a" ...)
    ;; now
    (map! :prefix ("a" . "label") ...)

+ It used to be that map! supported binding a key to a key sequence,
  like so:

    (map! "a" [?x])  ; pressing a is like pressing x

  This functionality was removed *temporarily* while I figure out the
  implementation.

Addresses: #448, #814, #860
Mentioned in: #940
2018-12-22 04:14:43 -05:00
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