Commit Graph

113 Commits

Author SHA1 Message Date
Henrik Lissner
6c4f4a9d9d
Mac users: command = super, option = meta
Apparently these have different defaults on emacs-mac, so we set these
to keep them consistent.
2019-09-05 13:11:22 -04:00
Henrik Lissner
1cd219dfa7
Update the docstring for leader/localleader vars
They should be set in your private config.el, not init.el.
2019-08-19 21:04:54 -04:00
Henrik Lissner
a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00
Henrik Lissner
e6201ca952
Add :if, :when, :unless & :cond support to doom! macro
Now you can conditionally enable/disable modules.
2019-07-26 12:05:13 +02:00
Henrik Lissner
003febd54c
Refactor doom--define-leader-key helper
And mark it as a hack, which it is, Mr. Anderson.
2019-07-23 18:14:49 +02:00
Henrik Lissner
876bed4813
Remove deprecated :map* & :keymap from map! macro
These have been deprecated for some time. They are all aliases for :map.
2019-07-23 17:35:56 +02:00
Henrik Lissner
76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00
Henrik Lissner
d7ed52f3c7
Add ui/hydra module
And conforms all existing hydras to the naming convention for
interactive commands, e.g.

  +vc-gutter-hydra -> +vc/gutter-hydra
2019-07-22 23:51:12 +02:00
Henrik Lissner
060ede0e2e
General, minor reformatting across the board
And an offering of blood to our great lord Byte Compiler-sama.
2019-07-22 02:37:45 +02:00
Henrik Lissner
fdcb259bcd
Major refactor of Doom core files
- Remove core-os and move many of its settings out to other core
  libraries, where they belong
- Significantly improve commenting & compartmentalization of many
  settings
- Correct some mis-named public hooks (that were named as if they were
  private)
- Move the vast majority of optimizations to "Optimizations" section in
  core.el
- Don't activate xclip-mode or osx-clipboard-mode if we're accessing
  Emacs through an SSH connection (does more bad than good there)
- Add fast-but-imprecise-scrolling = t
- Set bidi-display-reordering = 'left-to-right, at the recommendation of
  an Emacs dev. Apparently setting it to nil is undefined, as Emacs is
  designed to always assume it's set; setting it explicitly to
  left-to-right will still do what was originally intended by turning it
  off: to reduce line/text scans for bidirectional text, which gives us
  a moderate boost in general runtime snappiness
- Set inhibit-compacting-fon-caches = t on windows (where it struggles
  especially with icon fonts)
- Disables "literal" mode for very large files (because I will be
  backporting so-long.el from Emacs 27 in the next commit)
2019-07-22 02:30:38 +02:00
Henrik Lissner
149b2617b0
💥 revise hook/var fns naming convention (2/2)
This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:

1. Replace the bar | to indicate a hook function with a -h suffix, e.g.

     doom|init-ui -> doom-init-ui-h
     doom|run-local-var-hooks -> doom-run-local-var-hooks-h

2. And add a -fn suffix for functions meant to be set on variables,
   e.g.

     (setq magit-display-buffer-function #'+magit-display-buffer-fn)

See ccf327f8 for the reasoning behind these changes.
2019-07-22 02:30:38 +02:00
Henrik Lissner
abfc8ced21
Add warning re :prefix-map in map! docstring
It really shouldn't be used outside of Doom proper; it has the
capability of destroying other :prefix-map's due to variable/keymap
naming collisions.
2019-07-07 02:00:36 +02:00
Henrik Lissner
9a02bd8ac8
Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
Henrik Lissner
1e357310c4
Fix localleader alt key in insert mode 2019-06-26 14:28:40 +02:00
Henrik Lissner
7c33d2c2e0
Fix C-c & C-x when used as leader keys 2019-05-20 21:09:11 -04:00
Henrik Lissner
448d5fc71f
map!: fix :prefix-map for non-leader keys
Would no-op if used on a non-leader key.
2019-05-20 21:09:10 -04:00
Henrik Lissner
32f8fa9f46
Fix :prefix-map indentation in map! calls 2019-05-17 13:31:05 -04:00
Henrik Lissner
b7d1702484
Add :prefix-map to map! macro
Each prefix now defines a doom-leader-DESC-map keymap, where DESC is the
which-key description for that prefix key. This should make it easier
for users to move leader prefixes. e.g.

To move SPC TAB (workspaces) to SPC l:

  (map! :leader
        "TAB" nil
        "l" doom-leader-workspaces-map)
2019-05-13 22:30:21 -04:00
Henrik Lissner
ac55b6a826
Remove unused doom-which-key-leader-prefix-regexp 2019-04-26 17:39:13 -04:00
Henrik Lissner
a03b676297
Move leader which-key labels to core-keybinds 2019-04-26 17:29:54 -04:00
Henrik Lissner
068a324fd1
Fix which-key labels for alt leader key #1332
Also mentioned in #1240
2019-04-16 10:56:26 -04:00
Henrik Lissner
83cba583a7
with-eval-after-load -> after!
So :desc is ignored if which-key is disabled.
2019-04-11 18:29:23 -04:00
Henrik Lissner
3b352143c0
Fix commandp errors on {local,}leader keys
General would read (function ...) forms unevaluated, as a list, rather
than a function symbol.
2019-04-08 14:06:18 -04:00
Henrik Lissner
1fab389d9e
Fix #1310: use internal macro for leader binds
Creates a separate doom--define-leader-key macro for internal use (in
map!). define-leader-key! will continue to exist as a convenience macro
for users who want a general.el interface to defining leader keys.

Possibly relevant to: #1309
2019-04-07 15:55:16 -04:00
Henrik Lissner
43bc14d38e
Undo noop'ed leader binds for missing commands
This was too magical and caused more confusion than the void-function
and commandp errors before it.

Addresses #1309, #1308
Relevant to #1217
2019-04-06 11:13:17 -04:00
Henrik Lissner
9d65619d3e
Fix keybinds to keymaps being ignored 2019-04-05 03:43:27 -04:00
Henrik Lissner
d6c9520d93
Don't bind missing commands to leader keys
I don't want to litter config/default/+evil-bindings.el with conditions
for every keybind whose module may or may not be enabled. It impacts its
readability and is relatively expensive (due to the internals of map!
and general).

So instead, we no-op keybinds for commands that don't exist (and aren't
autoloaded), so you don't see missing function errors when using these
keys.
2019-04-05 02:52:49 -04:00
Henrik Lissner
ea3d9e2957
Refactor & optimize define-leader-key!
- Provides a 10-30% boost in startup time
- which-key advice is no longer needed
2019-04-05 01:24:16 -04:00
Jeffrey Chu
ec76d9acb6
Escape key regexps when building which-key leader prefix 2019-03-31 12:38:42 -07:00
Henrik Lissner
d868f5fd10
Use new ;;;###package cookie
This will later be used for doom/describe-packages to list all locations
where a package is being configured (along with def-package! and after!
blocks).
2019-03-13 01:55:50 -04:00
Henrik Lissner
dbff052c8a
Use doom-which-key-leader-prefix-regexp
Curse your sudden but inevitable betrayal, impatience.
2019-03-11 13:16:51 -04:00
Henrik Lissner
f332ba6111
Define doom-which-key-leader-prefix-regexp 2019-03-11 13:10:42 -04:00
Henrik Lissner
dadcd29f27
Refactor leader key initialization
Ensures general-override-mode is enabled and labels are correctly
registered to all (visible) leader keys.

Relevant to #1240
2019-03-11 13:06:46 -04:00
Henrik Lissner
b0bc1d925f
Minor refactors; revise docstrings+comments 2019-03-09 19:56:47 -05:00
Henrik Lissner
8e866bb37f
Improve leader key initialization
And ensure leader key always has precedence.

Indirectly fixes #1234
2019-03-09 02:42:23 -05:00
Henrik Lissner
c9e7d27317
Set leader keys later #1233
Setting them too soon means the user can't change them.
2019-03-08 14:23:42 -05:00
Henrik Lissner
a4c0bc2738
Optimize general integration
Using general to bind leader keys was responsible for 40-50% of Doom's
startup time. This change reduces that significantly, but not entirely.
It may be better that the config/default module not use map!. It is a
convenient macro, but general is a huge bottleneck.
2019-03-08 02:37:33 -05:00
Henrik Lissner
51129567d9
Mention $DOOMDIR/init.el in leader key docstrings
They need to be changed as soon as possible, otherwise leader keybinds
done before the change will use the old leader key.
2019-02-24 13:47:54 -05:00
Henrik Lissner
c82faf7f10
General reformatting & minor refactors 2019-02-19 15:53:26 -05:00
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