The defaults correspond to known evil-mode commands, and I don't appreciate the overrides. I currently remapped most of the org-fc defaults as sequences prefixed by a :localleader
.
However, this doesn't remove the default keymaps, which are accidentally executed when I assume I'm doing some evil-mode stuff. I assume this is because you are using a defvar
, but I don't know for sure.
I would really appreciate if this was easily customizable.
Here's my remapping code. I use Doom Emacs, in case you are wondering:
(map! :map org-fc-review-flip-mode-map :localleader [return] #'org-fc-review-flip :localleader "RET" #'org-fc-review-flip :localleader "n" #'org-fc-review-flip :localleader "s" #'org-fc-review-suspend-card :localleader "q" #'org-fc-review-quit) (map! :map org-fc-review-rate-mode-map :localleader "a" #'org-fc-review-rate-again :localleader "h" #'org-fc-review-rate-hard :localleader "g" #'org-fc-review-rate-good :localleader "e" #'org-fc-review-rate-easy :localleader "s" #'org-fc-review-suspend-card :localleader "q" #'org-fc-review-quit)
I don't think defining the keymaps with
defvar
instead ofdefcustom
makes a difference, e.g.org-mode-map
is adefvar
, too.Is there a way to replace the whole keymap with one you've defined instead of adding new keys to the existing ones?
I tried
(makunbound 'org-fc-review-flip-mode-map)
and then manually declaring the variable again in myconfig.el
using the keymaps I wanted, but that didn't seem to work at all. The above mapping code works as long as:
- In rate-mode, when I am in insert-mode (I am using Doom Emacs, which uses evil mode), I do not press
a
,h
,g
,e
,s
, andq
, which trigger the default keymaps oforg-fc-review-rate-mode-map
.- In flip-mode, when I am in insert-mode, I do not press
RET
,n
,s
, orq
, which again triggers the default keymaps oforg-fc-review-flip-mode-map
.This is my current config code related to
org-fc
and keymaps:(map! :map org-fc-review-flip-mode-map :localleader [return] #'org-fc-review-flip :localleader "RET" #'org-fc-review-flip :localleader "n" #'org-fc-review-flip :localleader "s" #'org-fc-review-suspend-card :localleader "q" #'org-fc-review-quit) (map! :map org-fc-review-rate-mode-map :localleader "a" #'org-fc-review-rate-again :localleader "h" #'org-fc-review-rate-hard :localleader "g" #'org-fc-review-rate-good :localleader "e" #'org-fc-review-rate-easy :localleader "s" #'org-fc-review-suspend-card :localleader "q" #'org-fc-review-quit) (add-hook! '(org-fc-review-flip-mode-hook org-fc-review-rate-mode-hook) #'evil-normalize-keymaps) (require 'org-fc-keymap-hint)I plan to test this a bit more later on and hopefully get it fixed, but for now, this janky solution is workable. If you have any insight as to the issue, please tell me.
You can remove all bindings from a keymap with
(setq org-fc-review-flip-mode-map (make-sparse-keymap))
, maybe that works better thanmakunbound
.
You can remove all bindings from a keymap with
(setq org-fc-review-flip-mode-map (make-sparse-keymap))
, maybe that works better thanmakunbound
.Tried this:
(setq org-fc-review-flip-mode-map (make-sparse-keymap)) (map! :map org-fc-review-flip-mode-map :localleader [return] #'org-fc-review-flip :localleader "RET" #'org-fc-review-flip :localleader "n" #'org-fc-review-flip :localleader "s" #'org-fc-review-suspend-card :localleader "q" #'org-fc-review-quit) ;; same for rate-mode and dashboard-mode (add-hook! '(org-fc-review-flip-mode-hook org-fc-review-rate-mode-hook) #'evil-normalize-keymaps) (require 'org-fc-keymap-hint)Unfortunately the keymaps stopped working entirely. Using
describe-variable
on the variables show that the bindings are there, but they just don't work in practice.
I've finally found a sustainable workaround for this issue by adding some code in the
init
block ofuse-package
:(use-package! org-fc :init ;; Remove flip mode and rate mode default keypmappings (defvar org-fc-review-flip-mode-map (let ((map (make-sparse-keymap))) map) "Keymap for `org-fc-flip-mode'.") (defvar org-fc-review-rate-mode-map (let ((map (make-sparse-keymap))) map) "Keymap for `org-fc-rate-mode'.") ;; Make dashboard mappings more convenient (defvar org-fc-dashboard-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-r") 'org-fc-review-dashboard-context) (define-key map (kbd "C-c C-q") 'quit-window) (define-key map (kbd "C-c C-g") 'org-fc-dashboard-view) map)) )The above piece of code ensures that the original keymaps do not ever function. I have defined my own keymaps for them instead.
i still don't understand why using
makunbound
+ a newdefvar
doesn't work, and that I need to create emptydefvar
s before the package is even loaded, to be honest, but I'm satisfied with this solution, and I'm sure otherevil
users will also be satisfied.