Commit graph

151 commits

Author SHA1 Message Date
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
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
a1c1d8818a
Fix #1456: handle remote PWDs in dashboard
Otherwise, invisible TRAMP authentication prompts would hang Emacs.
2019-06-11 16:21:37 +02:00
Henrik Lissner
4dbf8f206b
ui/doom-dashboard: refactor & optimize
Potentially addresses crashing issues caused by the dashboard.

Relevant to #1170
2019-05-15 15:22:08 -04:00
Henrik Lissner
6b69eaa397
Minor refactors across the board 2019-04-26 17:42:44 -04:00
Henrik Lissner
12a3adab2c
ui/doom-dashboard: fix evil motion keys #1365
Because :feature evil was moved to :editor evil, it is initialized
later, meaning evil map! keybinds prior to that module loading are
ignored. There's no harm in generalizing these remaps, however.
2019-04-26 17:29:54 -04:00
Henrik Lissner
f934f38627
ui/doom-dashboard: general refactor
Hopefully addresses #1170
2019-04-08 22:58:10 -04:00
Andrew Whatson
1081095a64 Initialize dashboard later on doom-init-ui-hook 2019-03-15 16:26:48 +10:00
Henrik Lissner
de2d681567
Initialize dashboard on doom-init-ui-hook 2019-03-15 01:36:57 -04:00
Andrew Whatson
910bfc41cc Initialize dashboard later in window-setup-hook
Since bb3f027c moved `projectile-mode` into `doom-init-ui-hook`,
projectile was getting initialized after the dashboard.  This means for
non-evil users, the `C-c p p` binding is not shown, because it's not yet
loaded.
2019-03-15 13:51:22 +10:00
Henrik Lissner
54d1c0dd56
Minor, general refactors 2019-03-09 03:42:55 -05:00
Henrik Lissner
a05b1877be
Rewrite switch-{buffer,window} hooks
+ Add doom-switch-frame-hook
+ Replace doom-{enter,exit}-{buffer,window}-hook with
  doom-switch-{buffer,window}-hook
+ New switch-buffer hooks run on buffer-list-update-hook rather than
  in select-window advice.
+ Blank our buffer-list-update-hook in some places to reduce how many
  times it gets triggered.
2019-03-08 02:37:33 -05:00
Henrik Lissner
d46bb287ae
General refactor of Doom core
- Code reduction and refactor across the board (cull unneeded minor
  advise, hooks and hacks or update them)
- Revise outdated comments and docstrings
- Reorganize core autoload libraries
- Remove large file check (Emacs already has a built-in one, which we
  augment to be even more performant when it does kick in)
- helpful.el can now be disabled completely through package!
2019-03-02 01:34:19 -05:00
Henrik Lissner
8a90f29c91
Make session persistence module agnostic
They've been removed from feature/workspaces and moved into
core/autoload/sessions, which falls back to desktop.el if persp-mode
isn't present. This also offers a substantial speed up to
restart+restoring and restoring sessions in general.

Also fixes #1210, where the newly spawned frame after doom/restart
wasn't focused.

Introduces the following commands:

- doom/restart
- doom/restart-and-restore
- doom/quickload-session
- doom/quicksave-session
- doom/load-session
- doom/save-session
- +workspace/restore-last-session (alias for doom/quickload-session)

And removes

- +workspace/load-session
- +workspace/save-session
- +workspace/load-last-session (renamed to +workspace/restore-last-session)
- +workspace/restart-emacs-then-restore (replaced by doom/restart-and-restore)
- :ss (ex command)
- :sl (ex command)
2019-03-02 01:34:19 -05:00
Henrik Lissner
735ec58b36
ui/doom-dashboard: show command at point in echo-area 2019-03-02 01:34:15 -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
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
5a442932d7
ui/doom-dashboard: reload dashboard in daemon frames
Fixes an issue where creating a graphical frame from the daemon can
cause the non-GUI version of the dashboard to show.
2018-10-17 14:49:35 -04:00
Henrik Lissner
0bb06f052e
Fix dashboard hiding files opened via emacsclient 2018-10-13 13:28:13 -04:00
Henrik Lissner
cc1c28a27c
Fix dual windows when opening files via terminal #850 2018-09-20 15:01:28 -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
50fdaa0ed5
Silence "unbound key" spam on mouse-1 in dashboard 2018-09-09 09:58:19 -04:00
Henrik Lissner
ee73d6c9af
Minor reformatting & comment tweaks 2018-08-21 03:34:39 +02:00
Henrik Lissner
6ab9cf6460
Switch org-agenda-list for org-agenda on dashboard 2018-08-17 04:10:11 +02:00
Henrik Lissner
e33cb446aa
Refactor dashboard banner display & centering 2018-08-10 12:34:17 +02:00
Henrik Lissner
923093b263
Don't set buffer-read-only in +doom-dashboard-mode
This is already set by the parent mode, special-mode.
2018-07-29 19:31:33 +02:00
Henrik Lissner
1a068f82f1
Add +workspace/load-last-session
And fix the load last session button on dashboard.
2018-07-07 11:41:24 +02:00
Henrik Lissner
c38d324663
Make banner customizable
Add banner-file and banner-dir variables. If banner-file is nil, use
ASCII banner.
2018-07-05 14:33:48 +02:00
Henrik Lissner
b67745a9b6
Don't show "Open user manual" button
...unless the manual exists (it will soon)!
2018-07-05 12:37:05 +02:00
Henrik Lissner
3a1ba5381e
Use +default/find-in-config instead on dashboard
Instead of browse-config.
2018-07-05 12:36:32 +02:00
Henrik Lissner
1fa4c65c3a
ui/doom-dashboard: minor refactor 2018-07-05 01:32:04 +02:00
Henrik Lissner
ebd4d19fa4
Fix +doom-dashboard-p 2018-07-04 23:14:12 +02:00
Henrik Lissner
c55d6dad17
Reduce coupling with buffers library and dashboard 2018-07-04 23:06:47 +02:00
Henrik Lissner
0b1cb1bb48
Look up command binds dynamically in dashboard
Keys are no longer hard coded.

cc @UndeadKernel
2018-07-04 23:05:49 +02:00
Henrik Lissner
ee4060ab80
Add image banner display logic to dashboard
But disabled by default (until the logo is ready).
2018-07-04 16:20:02 +02:00
Henrik Lissner
e37e6fc25c
Fix invalid face: quote errors in dashboard 2018-07-04 15:33:15 +02:00
Henrik Lissner
00e23db0b0
Fix workspace restore/load workspace keybinds
As well as keybind on dashboard.
2018-07-04 13:40:44 +02:00
Henrik Lissner
1d4a41833e
Don't wrap forward/backward-button keys 2018-07-03 20:07:14 +02:00
Henrik Lissner
d0eaa0af1e
Redesign dashboard widgets 2018-07-03 20:07:14 +02:00
Henrik Lissner
81ffed520b
Rename doom-before-switch-*-hook hooks
+ doom-before-switch-buffer-hook => doom-exit-buffer-hook
+ doom-before-switch-window-hook => doom-exit-window-hook
+ doom-after-switch-buffer-hook => doom-enter-buffer-hook
+ doom-after-switch-window-hook => doom-enter-window-hook

Shorter, easier-to-type names that better describe their intended
purpose.

The old names are still usable, but deprecated.
2018-07-03 03:41:08 +02:00
Henrik Lissner
15f2e21468
On second thought...
Causes char-table-p errors in some cases.

Setting hscroll-margin = 0 in dashboard accomplishes the same thing, by
preventing truncation glyphs from ever appearing anyway.
2018-06-30 02:58:01 +02:00
Henrik Lissner
a4121f33c0 Revert "Require project root in dashboard buffer #733"
This reverts commit 2dac739ce7.

Causes breaking "Not in project" errors at startup in certain daemon
workflows.
2018-06-29 00:56:04 +02:00
Henrik Lissner
2dac739ce7
Require project root in dashboard buffer #733
Require default-directory to be in a valid project for project commands
to work. This will prevent hangs when accidentally invoking
projectile-find-file from $HOME.
2018-06-28 20:15:50 +02:00
Henrik Lissner
205cc718d2
Fix dashboard not appearing in daemon frames
Because they start in the *server* buffer, instead of the *scratch*
buffer.
2018-06-19 17:44:24 +02:00
Henrik Lissner
486019d853
Remove leading space in dashboard buffer's name
The leading space indicates a temporary buffer. The dashboard is no such
thing!
2018-06-16 21:01:16 +02:00
Henrik Lissner
08986d9101
Simplify dashboard initial buffer check
We only need to check if we're in the scratch buffer. doom-real-buffer-p
is overkill for that.

This also reduces file loads at startup for autoloaded functions added
to the doom-real-buffer-functions and doom-unreal-buffer-functions.
2018-06-16 21:00:37 +02:00
Henrik Lissner
e71cd93488
Don't change which-key settings in doom dashboard 2018-06-03 17:22:23 +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
01b07e573e
Fix visual j/k in dashboard and evil-mode
In case you've remapped j/k to gj/gk universally.
2018-06-03 12:04:42 +02:00
Henrik Lissner
e66abfb9e8
Use newline-based alignment technique on dashboard
Fixes #645, because Emacs' mouse events don't appear to compensate for
variable-width whitespace.
2018-06-02 10:48:55 +02:00