I'm trying to unbind gs in evil-org-agenda-mode-map for the motion state so that evilem commands are available.
While evaluating (map! :map evil-org-agenda-mode-map :m "gs" nil) does the desired job, adding the same line to my +bindings.el and restarting Emacs doesn't have any effect at all. How can I fix this?
System information
emacs version 26.3
features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2
build Sep 16, 2019
buildopts (--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-TP6iDo/emacs26-26.3~1.git96dd019=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie')
windowsys x
daemonp server-running
doom version 2.0.9
build HEAD -> develop 2441b4478 2019-12-08 20:17:10 -0500
system type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/bash
uname Linux 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64
path (~/.cargo/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/lib/x86_64-linux-gnu/emacs/26.3/x86_64-linux-gnu)
config envfile nil
elc-files 0
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold format multiple-cursors rotate-text snippets :emacs dired electric ibuffer vc :term shell term :tools editorconfig ein (eval +overlay) flycheck flyspell (lookup +docsets) magit make pass pdf upload :lang cc data emacs-lisp latex markdown (org +dragndrop +ipython +pandoc +present) python sh :email mu4e :config (default +bindings +smartparens))
packages (academic-phrases (vlf :recipe (:host github :repo "m00natic/vlfi")) yasnippet-snippets yasnippet-classic-snippets buffer-move org-drill)
elpa (n/a)
Whenever you configure a package in Doom, it is good practice to wrap it in (after! PACKAGE-NAME ...). Or in map!'s case, (map! :after PACKAGE-NAME ...).
This ensures that any defaults imposed on you by Doom or its plugins (in this case, by evil-org-agenda) won't overwrite your new settings. So try this:
(map! :after evil-org-agenda
:map evil-org-agenda-mode-map
:m "gs" nil)
Thank you, that worked. But this gives me a few questions.
:after evil-org-agenda and not :after evil? What distinguishes features from modules?
I assume you're referring to "features" as mentioned in map!'s documentation:
:after [FEATURE] [...] apply keybinds when [FEATURE] loads
A feature is simply a symbol that represents an Emacs package. An Emacs package is an elisp file that ends with a (provide FEATURE) call. Like so. A provide effectively announces: "FEATURE has been loaded, don't try to load it again in future require calls for it, and execute any deferred code for FEATURE in after-load-alist".
(map! :after FEATURE ...) and (after! FEATURE ...) insert ... into after-load-alist.
I'm not sure which "modules" you mean, though. It's a generic term meaning a interchangeable and logical grouping of functionality. Did you mean "modes" instead?
How do I find out which feature overrides my bindings.
This is usually as straight-forward as:
Inspecting the key, e.g. SPC h k followed by the key sequence you want to inspect. It will tell you what command it is and what keymaps it's bound on (there may be multiple; it's up to you to determine which is relevant to you).

Then inspect the keymap itself with SPC h v followed by the name of the keymap. The name of the file the keymap is defined in is _usually_ the same as the feature name.

In this case, that is evil-org-agenda. You can be extra sure by clicking the package link and scrolling down to the provide call. Very few packages should have a feature that doesn't match its file name.
E.g. why do I have to specify :after evil-org-agenda and not :after evil?
Much of Doom is lazy loaded. Most of Doom's defaults don't take effect until the package loads. Setting a variable too soon risks it being changed later. Same with keybinds.
We use the evil-org package, which provides default evil keybinds for org. It applies these keybinds when org loads. Likewise, evil-org-agenda applies its keybinds after org-agenda loads. So in order for our own org agenda keybinds to apply last, we must bind them after evil-org-agenda loads.
If the above fails, you'll need to do some detective work. Here are a few places to check for, say, org keybinds:
Hope that helps!
I'm not sure which "modules" you mean, though. It's a generic term meaning a interchangeable and logical grouping of functionality. Did you mean "modes" instead?
I was referring to doom's modules. I didn't know that "features" were immanent to Emacs and thus, couldn't distinguish between them and a doom module. Maybe map!'s documentation should include an example that highlights this difference.
Then inspect the keymap itself with SPC h v followed by the name of the keymap. The name of the file the keymap is defined in is usually the same as the feature name.
Inspecting the keymap itself, is a nice little trick that I'll stick to in the future.
Your detailed answer is much appreciated, thank you.
Most helpful comment
I assume you're referring to "features" as mentioned in
map!'s documentation:A feature is simply a symbol that represents an Emacs package. An Emacs package is an elisp file that ends with a
(provide FEATURE)call. Like so. Aprovideeffectively announces: "FEATURE has been loaded, don't try to load it again in futurerequirecalls for it, and execute any deferred code for FEATURE inafter-load-alist".(map! :after FEATURE ...)and(after! FEATURE ...)insert...intoafter-load-alist.I'm not sure which "modules" you mean, though. It's a generic term meaning a interchangeable and logical grouping of functionality. Did you mean "modes" instead?
This is usually as straight-forward as:
Inspecting the key, e.g.
SPC h kfollowed by the key sequence you want to inspect. It will tell you what command it is and what keymaps it's bound on (there may be multiple; it's up to you to determine which is relevant to you).Then inspect the keymap itself with
SPC h vfollowed by the name of the keymap. The name of the file the keymap is defined in is _usually_ the same as the feature name.In this case, that is
evil-org-agenda. You can be extra sure by clicking the package link and scrolling down to theprovidecall. Very few packages should have a feature that doesn't match its file name.Much of Doom is lazy loaded. Most of Doom's defaults don't take effect until the package loads. Setting a variable too soon risks it being changed later. Same with keybinds.
We use the
evil-orgpackage, which provides default evil keybinds for org. It applies these keybinds when org loads. Likewise,evil-org-agendaapplies its keybinds afterorg-agendaloads. So in order for our own org agenda keybinds to apply last, we must bind them afterevil-org-agendaloads.If the above fails, you'll need to do some detective work. Here are a few places to check for, say, org keybinds:
Hope that helps!