DogLooksGood / emacs-rime

RIME ㄓ in Emacs
GNU General Public License v3.0
473 stars 69 forks source link

[BUG] rime-translate-keybindings 无法传递"comma" "period" 按键 #181

Open jiahut opened 2 years ago

jiahut commented 2 years ago

问题描述

rime-translate-keybindings 无法传递"comma" "period" 按键

Emacs中的配置

(use-package rime
  :config
  (setq rime-translate-keybindings '("C-f" "C-b" "C-g" "C-d" "C-h" "," ".")) 
)

复现方式

在rime种配置了以词定字插件 并配置 , , . 作为first/last的键位

  key_binder:
    select_first_character: 'comma'
    select_last_character: 'period'

以上配置在weasel(小狼毫) 中是可以work的 (一直在用)

据此判断在emacs-rime中貌似没有发送 comma, period 键位到librime中 (或者librime不支持lua插件?)

DogLooksGood commented 2 years ago

可以传递,比如说你用拼音的话就可以用 ,. 来进行翻页,我没有用过 lua 插件,不知道它是 librime 的功能,还是输入法具体实现的功能。

jiahut commented 2 years ago

也就是说传递给了librime,但是librime在和lua插件配合起来时可能不work?

DogLooksGood commented 2 years ago

是的,已有一些 issue 提到过和 lua 插件配合的问题。 可能需要 emacs-rime 这边完成 lua 插件的加载,但目前还清楚怎么实现。

jiahut commented 2 years ago

🙏🏻

暂不影响使用

两个判断暂记录一下, 待以后有空再研究 ( anyone如果有更solid的结论可以更新)

sincebyte commented 2 years ago

这问题无解了吗?我遇到了类似的问题。。配置了发送快捷键但不生效

DogLooksGood commented 2 years ago

@vanniuner 快捷什么键?贴下配置看一下?

如果是针对 lua 插件的问题,暂时无解。

sincebyte commented 2 years ago

我想发送C-n,C-p 来实现左右选词。但是触发的是另外一个按键。我用describe-key看的结果: It is bound to C-n. (evil-complete-next &optional ARG)

rime配置如下:

  key_binder/bindings:
    - { when: has_menu, accept: "Control+k", send: Page_Up }
    - { when: has_menu, accept: "Control+j", send: Page_Down }
    - { when: has_menu, accept: "Control+p", send: Left }
    - { when: has_menu, accept: "Control+n", send: Right }

配置如下 :

(use-package! rime
  :config
  (setq rime-show-candidate 'minibuffer)
  (setq rime-translate-keybindings '("C-n" "C-p"))
  :custom
  (rime-emacs-module-header-root emacs-module-root)
  (default-input-method "rime"))
  (setq mode-line-mule-info   '((:eval (rime-lighter)))
      gts-translate-list      '(("en" "zh"))
      rime-disable-predicates '(
         rime-predicate-current-uppercase-letter-p
         rime-predicate-after-ascii-char-p
         rime-predicate-space-after-cc-p)
      gts-default-translator   (gts-translator
       :picker (gts-prompt-picker)
       :engines (list (gts-google-engine) (gts-google-rpc-engine))
       :render (gts-buffer-render)))
DogLooksGood commented 2 years ago

在关闭 evil 的模式下是可以的吗?感觉 evil 的 C-n/C-p 的绑定的优先级不应该这么高才对。

sincebyte commented 2 years ago

M-x evil-mode to disable evil mode. describe-key result : It is bound to C-n, . (next-line &optional ARG TRY-VSCROLL)

截屏2022-01-03 13 26 48

DogLooksGood commented 2 years ago
(defvar rime-translate-keybindings
  '("C-f" "C-b" "C-n" "C-p" "C-g" "<left>" "<right>" "<up>" "<down>" "<prior>" "<next>" "<delete>")
  "A list of keybindings those sent to Rime during composition.

Currently only Shift, Control, Meta is supported as modifiers.
Each keybinding in this list, will be bound to `rime-send-keybinding' in `rime-active-mode-map'.")

默认值是这些,这些键都会在 rime 激活的时候绑定在 rime-active-mode-map, 就是有候选时使用的 keymap. 绑定的命令应该是 rime-send-keybinding

使用 M-x describe-keymap RET rime-active-mode-map 查看下。

我的是

image

sincebyte commented 2 years ago

M-x describe-keymap RET rime-active-mode-map: rime-active-mode-map is a keymap variable defined in ‘rime.el’.

Documentation: Keymap during composition.

key binding


RET rime--return C-n rime-send-keybinding C-p rime-send-keybinding DEL rime--backspace

rime--backspace rime--escape rime--return
DogLooksGood commented 2 years ago

看起来是对的,有点没头绪,可能需要一个最小可重现的配置。

sincebyte commented 2 years ago

关于rime最小的配置在上面回复里面。😂😂 完整的配置:https://github.com/vanniuner/neo-emacs

DogLooksGood commented 2 years ago

哦,因为光标离开的时候自动取消了 composition 所以没有办法通过 C-h k 来查看那个位置的按键。 然后就是在我这里什么配置都没有的情况下,C-n C-p 也是可以用的,因为 emacs-rime 和 rime 两端的默认配置里面都包含了 C-n C-p 的设置。

因为没有办法重现问题,所以我暂时没有头绪。

sincebyte commented 2 years ago

我也是两边都加了的,操作系统的rime程序可以通过c-n/p 来进行左右选词,但在emacs rime里面就不行了,不能复现就先这样吧,还是感谢狗哥

jiahut commented 2 years ago

应该是在evil-insert-mode下, C-n/p的被动态绑定回来了.