Closed xiaobing-huang closed 2 days ago
I am still running into this issue. Why is it closed? For me, it's
Debugger entered--Lisp error: (error "Key sequence l b b starts with non-prefix key l b")
I believe it clashes with the doom emacs collab
keybindings...
@RomeoV does that mean update this line will resolve the issue? https://github.com/tninja/aider.el/blob/main/aider-doom.el#L24
(Not quite familiar with doom emacs, would be great to let me know how to fix this, Thanks.)
Also cc @khtdr
I'll look at your link tomorrow. But mostly the "issue" is just that both this package and the doom emacs "collab" config set map keys starting with <leader> l
, but with different settings.
For doom users, they will be fine for now just commenting out the collab
feature in their init.el
file.
Perhaps this package could have a flag whether to use the proposed keymaps or not.
This is where doom defines the keymap:
Specifically e.g.
(:when (modulep! :tools collab)
(:prefix-map ("l" . "live share/collab")
:desc "Switch to a shared buffer" "b" #'crdt-switch-to-buffer
:desc "Connect to a session" "c" #'crdt-connect
Now, compared to the config for doom in this package
(when (and (featurep 'doom-keybinds)
(vc-backend (or (buffer-file-name) default-directory)))
(map! :leader
(:prefix ("l" . "Aider")
(:prefix ("a" . "Add")
:desc "Current file" "c" #'aider-add-current-file
:desc "Files in window" "w" #'aider-add-files-in-current-window
:desc "Batch direct marked files" "b" #'aider-batch-add-dired-marked-files
:desc "Find files in repo" "g" #'aider-repo-find-name-dired
:desc "Open repo root" "d" #'aider-git-repo-root-dired)
(:prefix ("b" . "Buffer")
:desc "Switch to Aider" "b" #'aider-switch-to-buffer
:desc "Clear Aider" "c" #'aider-clear)
We can see that the root issue occurs when the doom collab
option is enabled (and evil
mode), the prefix-map l
is created, with some keybindings. Then the aider package creates the prefix
l
with a different name and bindings.
Btw, here's what the help string of map!
says about :prefix
vs :prefix-map
:
:prefix [PREFIX] [...] set keybind prefix for following keys. PREFIX
can be a cons cell: (PREFIX . DESCRIPTION)
:prefix-map [PREFIX] [...] same as :prefix, but defines a prefix keymap
where the following keys will be bound. DO NOT
USE THIS IN YOUR PRIVATE CONFIG.
I'm not quite sure whether to use a prefix
or prefix-map
here and what the implications are.
But as of now, the problem is just that both aider
and the collab
doom config define a prefix for :leader l
.
Ok I think I've figured out the solution.
We should be using prefix-map
instead of prefix
in this package, will will then create a new variable doom-leader-Aider-map
, which we can use to rebind to a different key.
For example, we can remap the keymap to
;; Start by unmapping the conflicting leader key from both `collab` and `aider`
(map! :leader "l" nil)
;; Now reassign properly to different keys
(map! :leader "l" doom-leader-Aider-map)
(map! :leader "L" doom-leader-collab-map)
@RomeoV Thanks for checking into the issue. Wonder if changing the leader key of this package to some other key will resolve the conflict? Eg. key "a"? or key "L"? If the new key have no conflict, it might be quick and easy change.
I am not using doom emacs, would be great to get some suggestion. Thanks
just talked with aider and he told me that "collab" is an optional module. Seems that not all DOOM emacs user will hit the issue. aider also suggest to use "A" if there is a key conflict ("a" has already been taken for application given his feedback)
Yes that's right. Using prefix "A" would probably work.
Close this issue since lead key has been changed to "A"
Error happened while open a file: