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

pyim-convert-string-at-point遇到-前面的英文也会转换为中文 #304

Open
ab9986 opened this issue Aug 5, 2019 · 5 comments

Comments

@ab9986
Copy link

commented Aug 5, 2019

我输入good-ni,调用pyim-convert-string-at-point,发现goodni全部转成中文,但实际上只要转换-后面ni为中文即可,所以我对pyim-convert-string-at-point做了修改,将-进行过滤,帮忙看看是否可行
;; +++ pyim.el (working copy)
;; (cond ((string-match
;; ;; 创建一个 regexp, 用于提取出光标处一个适合
;; ;; 转换的字符串。
;; - (format "[%s]+ *$"
;; - (cl-delete-duplicates
;; - (concat first-chars rest-chars "'-")))
;; + (replace-regexp-in-string "-" "" (format "[%s]+ *$"
;; + (cl-delete-duplicates
;; + (concat first-chars rest-chars "'-"))))
;; string)
;; (setq code
;; ;; 一些编程语言使用单引号 ' 做为字符串的标记,这里需要特殊处理。

@tumashu

This comment has been minimized.

Copy link
Owner

commented Aug 6, 2019

这样做有点hack,不过个人用还是可以的,产生这个问题的根本原因是,pyim里面允许拼音中有-号

@ab9986

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

我试一下,输入中文时,无法输入-,只是看到词典pyim-basedict.pyim中用-进行分割拼英例如:ren-ran。另外我用过rg进行搜索词典pyim-basedict.pyim,全词匹配很快,所以想pyim后端用rg匹配取词,这样emacs内存占用大问题可以解决。

@tumashu

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

(quanpin
:document "全拼输入法方案(不可删除)。"
:class quanpin
:first-chars "abcdefghijklmnopqrstuwxyz"
:rest-chars "vmpfwckzyjqdltxuognbhsrei'-a"
:prefer-trigger-chars "v")

是这个地方设置的缘故,

@tumashu

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2019

最近有朋友添加了一个pyim-dregcache后端,内存消耗很小,你可以试试

(setq pyim-dcache-backend 'pyim-dregcache)

@ab9986

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

(setq pyim-dcache-backend 'pyim-dregcache) 非常不错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.