Commit Graph

74 Commits

Author SHA1 Message Date
Henrik Lissner
a5f53098e3
Merge pull request #1106 from y-usuzumi/develop
Fix an issue where doom-leader-alt-key and doom-localleader-alt-key does not work in emacs mode
2019-01-20 14:15:55 -05:00
Henrik Lissner
aaee04e257
Remove unused doom-leader prefix command 2019-01-14 21:24:52 -05:00
Kenneth Zhao
0a7717786c Fix an issue where doom-leader-alt-key and doom-localleader-alt-key does not work in emacs mode 2019-01-10 11:45:32 +08:00
Henrik Lissner
069c196330
Appease byte-compiler senpai
Please notice me
2019-01-08 20:54:03 -05:00
Henrik Lissner
25b9a90c12
Fix localleader keys in replace state #1097 2019-01-07 04:57:54 -05:00
Henrik Lissner
a4cd5fafd8
Don't unbind keys when passed a label to :prefix
Fixes an issue where

  (map! :leader
        :prefix ("f" . "asdasdas")
        ...)

Would unbind SPC f before adding your new keybinds.
2019-01-03 02:26:11 -05:00
Henrik Lissner
d3882f539c
Remove :if from map!
It doesn't work as expected and would require too much work to support.
2019-01-02 13:18:19 -05:00
Henrik Lissner
afee81dfde
Fix define-leader-key! comment 2018-12-28 15:22:29 -05:00
Henrik Lissner
63a224f0e8
Fix wrong which-key labels & leader key precedence
This changes how leader keys are bound, to fix an issue where the wrong
which-key label was assigned to the wrong keys, and cases where the
leader key was being shadowed by other minor mode mappings.

Unfortunately, this new method adds 10-20% to startup times. I'll
address this in a future patch. For now, correctness is more important.

Also fixes dashboard keybind detection.
2018-12-27 00:08:47 -05:00
Henrik Lissner
b7cfa90967
Update map! docstring
And remove all references to :alt-prefix
2018-12-26 00:55:39 -05:00
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