Commit Graph

114 Commits

Author SHA1 Message Date
Henrik Lissner
c0c84eb99b
Fix M-SPC error with helm #1059
The global leader keybind was conflicting with a global M-SPC keybind in
helm-map. This keybind should only be set in non-evil sessions, so we
unset it if evil is found.
2018-12-25 03:56:24 -05:00
Henrik Lissner
d337e255d3
Fix :leader/:localleader and :prefix
Due to issues with preset prefixes in general definers and nested
:prefix's supplied from a map! call not cooperating, many localleader
keybinds were broken and causing errors. For :leader/:localleader keys,
we now use :infix for sub-prefixes.

However, with this change, the :alt-prefix property has been removed, as
there is no simple way to support this without some major state
gymnastics in map!.

Fixes #1059
2018-12-25 02:29:29 -05:00
Henrik Lissner
5ad0b749a1
Refactor map! & tests
This resolves issues with :leader/:localleader keys not working when
evil states are specified. Evil states are now ignored. Also, some of
map!'s internals have been optimized to yield a ~10% improvement in
macro expansion time.
2018-12-23 23:12:10 -05:00
Henrik Lissner
0efa915164
Fix :leader/:localleader targeting preceding keys
This fixes an issue where even the keys preceding :leader/:localleader
were registered as leader/localleader keys.
2018-12-23 00:10:18 -05:00
Henrik Lissner
91474c98ee
Fix localleader binds hijacking SPC in insert mode 2018-12-22 19:33:20 -05:00
Henrik Lissner
4383531b32
Ensure gerneral-implicit-kbd=t in map!
Also updates map! tests (TODO: abstract all those cdr-caddr's!)
2018-12-22 17:11:20 -05:00
Henrik Lissner
604a41527f
Use general custom definers rather than :definer
The former approach was the cause for a huge increase in startup
time (adding ~0.4s) when :leader and :localleader were used. This is
because general-define-key was called for every key-def pair.

This new approach batches these calls, which has decreased the
performance impact by at least 80%.
2018-12-22 16:50:01 -05:00
Henrik Lissner
4d3587c8d0
Fix void-variable list error in multi-state binds
Caused by overzealous re-setting of a variable in a loop, when it should
only be set once.
2018-12-22 05:20:43 -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
0c39e73a1e Refactor/reformat core-ui
+ Move minibuffer fringe disabler to ui/doom
+ Disable blink-cursor-mode (too distracting, causes other issues e.g.
  #892)
2018-09-18 15:19:50 -04:00
Henrik Lissner
895df84f8b Add key-to-key binding support to map!
Experimental, and will eventually be replaced by general-simulate-key.
2018-09-18 15:19:50 -04:00
Henrik Lissner
57579b883b
Refactor doom core files 2018-09-09 09:58:20 -04:00
Henrik Lissner
b1aa478528
map!: clear doom--defer
So deferred keybinds don't persist across nested map! forms.
2018-08-01 02:41:46 +02:00
Henrik Lissner
017ba8d79c
Autoload defhydras & use new naming convention
Phasing out the +module@name convention for plain old
+module-name-hydra, which is more compatible with elisp reflection tools
like describe-function and such.

Also, Emacs starts up faster now. Tee hee.
2018-06-26 01:43:54 +02:00
Henrik Lissner
b3fa3cda28
Lazy load which-key
GOTTA

GO

FAST
2018-06-25 15:46:31 +02:00
Henrik Lissner
11b5a7116f
Allow map!'s :prefix to accept key vectors 2018-06-15 16:20:20 +02:00
Henrik Lissner
b2030c6ed3
Refactor doom/escape
Now returns first hook that returns non-nil; this makes it a little
easier to debug doom-escape-hook.
2018-06-04 00:07:03 +02:00
Henrik Lissner
796af69c28
Move define-key! macro to core-lib 2018-06-03 23:52:21 +02:00
Henrik Lissner
1e81a35461
Minimize dependence on map!
This is in preparation for general.el integration coming in 2.1.1. It is
very likely that map! will change (and even more, be split into several
macros). Not much, but change none-the-less. Specifically, the state
keywords (e.g. :nvi, :n, :i) will be removed in favor of a :state
property that takes a list, e.g. (normal visual insert).

In any case, both map! and general are also relatively expensive
compared to define-key and evil-define-key* (and the new define-key!
macro), so use that when we can.

This also means changes to either API won't affect Doom's modules in the
long term.
2018-06-03 15:46:00 +02:00
Henrik Lissner
e5a4415d58
General, minor reformatting/refactor 2018-06-02 13:58:04 +02:00
Henrik Lissner
3359d351f5
Add define-key! macro; refactor config/default key fixes
I'd like to phase out map! where it isn't absolutely necessary, since it
isn't very well optimized.
2018-06-01 02:17:10 +02:00
Henrik Lissner
97cbb13c22
Improve which-key readability 2018-05-31 16:19:28 +02:00
Henrik Lissner
0b48575c14
Remove def-hydra! macro alias
Causes byte-compilation issues and the alias is unnecessary.
2018-05-24 22:03:19 +02:00
Henrik Lissner
da5c7d27cf
Use correct init hook (doom-post-init-hook) 2018-05-20 12:18:48 +02:00
Henrik Lissner
bec79a3d4c
Major refactor of Doom bootstrap process
+ New `input` and `buffer` support for :defer in def-package! can now
  defer packages until the first command invoked after startup or first
  interactive buffer switch, respectively
+ Exploit these new :defer techniques to lazy-load many core packages,
  netting Doom a 20-30% decrease in startup time
+ Various userland macros (like package!, def-package-hook!, packages!,
  and disable-packages!) will now throw an error if used incorrectly
  (i.e. outside of their intended files; e.g. package! should be used in
  packages.el files)
+ Removed support for multiple/nested doom! calls. There should only be
  THE ONE in ~/.doom.d/init.el (or ~/.config/doom/init.el)
+ Fix an issue where load-path and auto-mode-list modifications would
  not persist because doom-packages-file was cached too late.
+ Added package-activated-list to cached variables in
  doom-packages-file, thus we no longer need custom-file.
+ Load Doom core files from doom-initialize. Now doom-initialize can be
  called from state-dependent non-interactive functions, instead of
  reloading core/core.el, which was clumsy
+ Removed the doom-post-init-hook hook. There was no reason for it to
  exist when doom-init-hook can simply be appended to
2018-05-14 20:37:13 +02:00
Henrik Lissner
54bb452a12
Fix map! ignoring global keybinds when evil wasn't loaded 2018-05-07 22:01:43 +02:00
Henrik Lissner
5743e7da7a
Revert "enable which-key's evil support" #536
This reverts commit b3260f6a9e.

Fixes #542
2018-04-22 18:37:10 -04:00
Carter Charbonneau
b3260f6a9e enable which-key's evil support 2018-04-18 11:18:52 -06:00
Henrik Lissner
8a74a081c4
Remove doom-mode-map; semi-revert abe42fcb 2018-03-27 03:49:45 -04:00
Henrik Lissner
f8801640ba
Mention :leader/:localleader in map! docstring 2018-03-22 21:15:07 -04:00
Henrik Lissner
abe42fcb9a
Give config/default keybinds higher precedence
This is highly experimental! It gives keybinds bound with `map!` much
higher precedence, allowing it to override the defaults imposed by
major modes and plugins (like evil-collection).
2018-03-22 06:28:33 -04:00
Henrik Lissner
da92423e40
Inhibit doom/escape on ESC while executing macros #471 2018-03-21 15:11:52 -04:00
Henrik Lissner
1b5758a6da
Minor refactor 2018-03-18 03:36:05 -04:00
Henrik Lissner
54393534ff
Don't abort kbd macros on doom/escape #455 2018-03-07 01:58:13 -05:00
Henrik Lissner
68e735938b
core-keybinds: remove redundant quotes 2018-02-04 17:29:03 -05:00
Henrik Lissner
414383e5f4
Remove vestigial references to doom/{next,previous}-buffer 2018-02-04 05:05:40 -05:00
Henrik Lissner
8520c12434
which-key: don't replace current popup 2018-01-07 06:19:54 -05:00
Henrik Lissner
60cded00e6
Decouple doom/escape & evil 2018-01-06 03:00:45 -05:00
Henrik Lissner
3cbddbfd88
Generalize +evil-esc-hook into doom-escape-hook
This lets vanilla Emacs users in on having a universal "escape" key.
2018-01-06 02:38:39 -05:00
Henrik Lissner
76a4ae459d
Fix obsolete (when|if)-let messages in Emacs 26 2017-12-10 14:49:52 -05:00
Henrik Lissner
9d81bc5a8b
Major refactor: use-package-always-defer = nil & use :hook
Possibly breaking change: packages are no longer deferred by default.

Addresses #286
2017-12-08 23:14:11 -05:00
Henrik Lissner
c45e2c4918
General & minor refactor+cleanup 2017-11-05 19:54:44 +01:00
Henrik Lissner
19ca683f86
Add :g switch to map! #249 2017-10-25 14:50:02 +02:00
Henrik Lissner
597bfb1a3c
Move feature/hydra into core-keybinds 2017-09-24 17:10:47 +02:00
Henrik Lissner
efb1e916e4
Refactor core-keybinds 2017-07-27 19:10:01 +02:00
Henrik Lissner
5057db93f1
Replace :L state with :local flag in map!
Fixes #162
2017-07-27 19:09:33 +02:00
V. Subramani Raju
6d4c9c83c3 fix :text-obj map macro 2017-06-23 09:27:03 +05:30
Henrik Lissner
4984a548d1
Refactor DOOM init & add new init hooks
+ Add doom-init-hook and doom-post-init-hook to simplify Emacs init
  hooks into less ambiguous ones.
+ Attach former after-init-hook and emacs-startup-hook hooks to new doom
  init hooks.
+ Vastly improves daemon and tty support: preventing incorrect colors
  from bleeding across face class barriers, and into GUI Emacs and vice
  versa, when spawned with emacsclient.
+ Fix persp-mode breaking Emacs daemon, and ensuring that initialization
  is done properly in terminal Emacs (and emacsclient frames).
2017-06-12 00:37:14 +02:00
Henrik Lissner
2097498f3e
General docstring+idempotency refactor 2017-06-11 00:59:02 +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
15e8a37186 map!: support variables for keys 2017-05-28 16:14:37 +02:00
Henrik Lissner
4fcfec6344 Add :textobj keyword to map! 2017-05-28 02:48:20 +02:00
Henrik Lissner
fbe782df22 Heavily redesign keybinding design
+ SPC and SPC m as leader/localleader (spacemacs-ey)
+ Move all custom keybindings to private +bindings.el file
+ Redesign+rearrange keybindings
2017-05-28 02:48:20 +02:00
Henrik Lissner
39c3d6aae4 Enable which-key popups for all prefix keys 2017-05-20 18:40:13 +02:00
Henrik Lissner
615cf15313 General refactor & cleanup 2017-05-17 21:07:41 +02:00
Henrik Lissner
b2d8ddd322 core-keybinds: refactor 2017-05-16 18:05:39 +02:00
Henrik Lissner
cf79e45cf5 map!: fix :when, :unless & :after blocks 2017-05-15 20:26:32 +02:00
Henrik Lissner
cc37a2d6e7 Integrate major-mode-specific which-key defs into map! 2017-05-07 02:45:52 +02:00
Henrik Lissner
5ae94b765c PRAISE BE TO THE BYTE COMPILER FOR THY SHARP QUOTES 2017-04-17 02:17:10 -04:00
Henrik Lissner
80c3584a78 core-keybinds: enhance readability of which-key popup 2017-03-07 14:56:41 -05:00
Henrik Lissner
4c3652bede map!: declare indent properties for :leader and :localleader 2017-03-01 21:39:58 -05:00
Henrik Lissner
27cc4a9508 reverse => nreverse; other optimizations 2017-03-01 19:15:45 -05:00
Henrik Lissner
33c88d4f82 Revert macros to ...! name convention (elisp doesn't like @...) 2017-02-23 00:06:12 -05:00
Henrik Lissner
704099a7b9 Add core-keybinds.el 2017-02-20 00:26:07 -05:00