Commit Graph

107 Commits

Author SHA1 Message Date
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
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
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
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
57579b883b Refactor doom core files 2018-09-09 09:58:20 -04:00
b1aa478528 map!: clear doom--defer
So deferred keybinds don't persist across nested map! forms.
2018-08-01 02:41:46 +02:00
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
b3fa3cda28 Lazy load which-key
GOTTA

GO

FAST
2018-06-25 15:46:31 +02:00
11b5a7116f Allow map!'s :prefix to accept key vectors 2018-06-15 16:20:20 +02:00
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
796af69c28 Move define-key! macro to core-lib 2018-06-03 23:52:21 +02:00
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
e5a4415d58 General, minor reformatting/refactor 2018-06-02 13:58:04 +02:00
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
97cbb13c22 Improve which-key readability 2018-05-31 16:19:28 +02:00
0b48575c14 Remove def-hydra! macro alias
Causes byte-compilation issues and the alias is unnecessary.
2018-05-24 22:03:19 +02:00
da5c7d27cf Use correct init hook (doom-post-init-hook) 2018-05-20 12:18:48 +02:00
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
54bb452a12 Fix map! ignoring global keybinds when evil wasn't loaded 2018-05-07 22:01:43 +02:00
5743e7da7a Revert "enable which-key's evil support" #536
This reverts commit b3260f6a9e.

Fixes #542
2018-04-22 18:37:10 -04:00
b3260f6a9e enable which-key's evil support 2018-04-18 11:18:52 -06:00
8a74a081c4 Remove doom-mode-map; semi-revert abe42fcb 2018-03-27 03:49:45 -04:00
f8801640ba Mention :leader/:localleader in map! docstring 2018-03-22 21:15:07 -04:00
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
da92423e40 Inhibit doom/escape on ESC while executing macros #471 2018-03-21 15:11:52 -04:00
1b5758a6da Minor refactor 2018-03-18 03:36:05 -04:00
54393534ff Don't abort kbd macros on doom/escape #455 2018-03-07 01:58:13 -05:00
68e735938b core-keybinds: remove redundant quotes 2018-02-04 17:29:03 -05:00
414383e5f4 Remove vestigial references to doom/{next,previous}-buffer 2018-02-04 05:05:40 -05:00
8520c12434 which-key: don't replace current popup 2018-01-07 06:19:54 -05:00
60cded00e6 Decouple doom/escape & evil 2018-01-06 03:00:45 -05:00
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
76a4ae459d Fix obsolete (when|if)-let messages in Emacs 26 2017-12-10 14:49:52 -05:00
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
c45e2c4918 General & minor refactor+cleanup 2017-11-05 19:54:44 +01:00
19ca683f86 Add :g switch to map! #249 2017-10-25 14:50:02 +02:00
597bfb1a3c Move feature/hydra into core-keybinds 2017-09-24 17:10:47 +02:00
efb1e916e4 Refactor core-keybinds 2017-07-27 19:10:01 +02:00
5057db93f1 Replace :L state with :local flag in map!
Fixes #162
2017-07-27 19:09:33 +02:00
6d4c9c83c3 fix :text-obj map macro 2017-06-23 09:27:03 +05:30
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
2097498f3e General docstring+idempotency refactor 2017-06-11 00:59:02 +02:00
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
15e8a37186 map!: support variables for keys 2017-05-28 16:14:37 +02:00
4fcfec6344 Add :textobj keyword to map! 2017-05-28 02:48:20 +02:00
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
39c3d6aae4 Enable which-key popups for all prefix keys 2017-05-20 18:40:13 +02:00
615cf15313 General refactor & cleanup 2017-05-17 21:07:41 +02:00
b2d8ddd322 core-keybinds: refactor 2017-05-16 18:05:39 +02:00
cf79e45cf5 map!: fix :when, :unless & :after blocks 2017-05-15 20:26:32 +02:00