corgi-emacs / corgi

Unbundled Emacs configuration aimed at Clojure developers
180 stars 18 forks source link

Corkey needs support for mode/key-maps #10

Closed oxalorg closed 2 years ago

oxalorg commented 3 years ago

I keep finding myself doing lots of custom keybinds to either remove binds from specific maps or add them.

This means that my keybinds are no longer collected at one place and they are spread all over my init.el + custom corkey file.

Example:

((evil-define-key '(normal visual) evil-cleverparens-mode-map
    "s" nil
    "S" nil
    "{" nil
    "}" nil
    "[" nil
    "]" nil))

(with-eval-after-load 'evil-maps
  (define-key evil-motion-state-map (kbd ":") 'evil-repeat-find-char)
  (define-key evil-motion-state-map (kbd ";") 'evil-ex))

(with-eval-after-load 'dired
  (put 'dired-find-alternate-file 'disabled nil) ; disables warning
  (evil-define-key '(normal) dired-mode-map
    (kbd "RET") 'dired-find-alternate-file ; was dired-advertised-find-file
    (kbd "^") (lambda () (interactive) (find-alternate-file "..")))) ; was dired-up-directory

I think all of these could have been done directly from corkey, but then would that support deferred loading like evil-define-key or with-eval-after-load does? :thinking:

plexus commented 3 years ago

Have you tried putting these in your corkey bindings? they should take precedence.

plexus commented 2 years ago

Closing this as managing non-corkey keymaps is a non-goal. We install the corkey bindings so that they should always take precedence (if not, that's a bug and can be filed as such).

There will still be bindings leaking through for key combinations for which no corgi binding exists. I've experimented with approaches to bulk-unbind these but it's an extreme solution. Ideally we should encourage package maintainers to not install bindings by default (or at least have them in an opt-in "instal-bindings" function), but that's a 40+ year old practice at this point so I don't expect that to change any time soon. Meanwhile I think it's no big issue, if a key doesn't do what you want just bind it in Corkey.