Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jiahut opened this issue Dec 7, 2021 · 16 comments
Open

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

jiahut opened this issue Dec 7, 2021 · 16 comments
Labels
question Further information is requested

Comments

@jiahut
Copy link

jiahut commented Dec 7, 2021

问题描述

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插件?)

  • 操作系统:如 Win10
  • Emacs版本:如 29.0.50
  • Librime版本:如 1.5.3
  • Librime安装方式: 手工编译
  • 安装方式: Melpa
@jiahut jiahut added the bug Something isn't working label Dec 7, 2021
@DogLooksGood DogLooksGood added the question Further information is requested label Dec 7, 2021
@DogLooksGood
Copy link
Owner

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

@jiahut
Copy link
Author

jiahut commented Dec 7, 2021

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

@DogLooksGood
Copy link
Owner

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

@jiahut
Copy link
Author

jiahut commented Dec 8, 2021

🙏🏻

暂不影响使用

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

  • librime是否已经支持了lua的plugin机制?
    • 大概率有, 当前插件配置需要patch到 engine/processors 这个节点
  • plugin服务发现以及加载是在应用层来实现的吗? (在这里的语境下, 小狼毫/emacs-rime 就是应用层 )
    • 大概率是, 目前下在 rime_home 目录下有个 rime.lua 来加载具体的插件 processA = require(some-plug')`

@DogLooksGood DogLooksGood removed the bug Something isn't working label Dec 14, 2021
@sincebyte
Copy link

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

@DogLooksGood
Copy link
Owner

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

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

@sincebyte
Copy link

我想发送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
Copy link
Owner

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

@sincebyte
Copy link

sincebyte commented Jan 3, 2022

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
Copy link
Owner

(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
Copy link

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
Copy link
Owner

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

@sincebyte
Copy link

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

@DogLooksGood
Copy link
Owner

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

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

@sincebyte
Copy link

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

@jiahut
Copy link
Author

jiahut commented Jan 11, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants