meow icon indicating copy to clipboard operation
meow copied to clipboard

Single-letter keybindings don't work when an input method is active

Open algor512 opened this issue 2 years ago • 3 comments

Minimal init.el:

(add-to-list 'load-path "~/.config/emacs/elpa/meow-20220629.520")
(set-input-method 'russian-computer)
(require 'meow)
(meow-normal-define-key '("j" . meow-next))
(meow-global-mode 1)

Steps to reproduce:

  1. Run emacs.
  2. C-x b *scratch*
  3. j works as expected if the input method is inactive. Once it is activated with C-\, pressing j raises an error "о in undefined".

Expected behavior: j works both when the input method is active and it is not.

algor512 avatar Jul 06 '22 10:07 algor512

Well, when the input method is activated, the input event will be sent to the input method first. And the input method maybe translate the event, may not.

A few options here:

  1. Check if the input method provides a way to specifying whether the translation should be enabled or not.
  2. Use the hooks provided by Meow, to activate / deactivate the input method.

DogLooksGood avatar Jul 09 '22 13:07 DogLooksGood

I noticed that in modalka-mode it works well. Maybe due to this line:

(advice-add 'quail-input-method :around #'modalka--input-function-advice)

but I'm not sure.

algor512 avatar Jul 09 '22 16:07 algor512

Yep, you can have something like this. If not (meow-insert-mode-p), then return the input itself, otherwise call the input method function.

DogLooksGood avatar Jul 12 '22 20:07 DogLooksGood