minad / jinx

🪄 Enchanted Spell Checker
GNU General Public License v3.0
432 stars 21 forks source link

Define a `jinx-mode-map` #22

Closed Stebalien closed 1 year ago

Stebalien commented 1 year ago

Please consider defining a :keymap for jinx-mode. I'd like to be able to bind a key for spell-checking but only when jinx-mode is enabled.

minad commented 1 year ago

My current tendency is not to define such a map, since it would likely be empty. But there is a discussion about the UI ongoing in #9, so that's not set in stone. Is it a common pattern for modes to defines maps even if they are unused by default?

You can always use M-$ since this key binding is already occupied by ispell-word. Why is it not a good idea to always remap this command? Maybe you use a heavily tuned configuration, e.g., Evil users may have different requirements?

minad commented 1 year ago

Okay, I took look at some Emacs source. It seems not uncommon to provide empty maps, e.g., flymake-mode-map, subword-mode-map (but this one seems legacy), hl-todo-mode-map. Let's just do this then.

Stebalien commented 1 year ago

For some context, I am an evil user so I wanted to bind this to s but only in modes where spell-checking is enabled.

Thanks!

gusbrs commented 1 year ago

@minad Adding a suggestion in this regard. What do you think of also providing a keymap for jinx-correct? That could ease bindings for "actions" (save, skip, etc.)

minad commented 1 year ago

@gusbrs Let's not do this for now since the UI is not yet fixed. In the future, we could a map to move backward and forward over errors. I already overhauled the overlay infrastructure slightly in that regard, see https://github.com/minad/jinx/commit/983ffa2862209800444810916796ce8f0719bb60.

gusbrs commented 1 year ago

@minad Sure, I understand. And I'm playing with that commit at this very moment (fooling around with a "flyspell-correct like jinx" ;-)