chinese 这个词语太长,太大众化了,真不适合作为前缀的使用,
melpa 的维护者明确表示, 包名称应该和包前缀是一样的, 写新包的同学稍微注意一下吧:
是不是也给 spacemacs 提交一个 pr?chinese layer 的一个核心应用就是 pyim
其实已经提了。你不是第一个想到的
有其它同学提过了,不过我不太了解 spacemacs, 也没有兴趣搞 spacemacs …
把 chinese-pyim 卸载后安装 pyim ,(require 'pyim-basedict)
失败,但依赖里有 pyim-basedict
这是为啥
安装pyim-basedict包
我已经用上了,放了一个加了IME补丁的Emacs在github,引用了日本人的补丁
有这个包,作为依赖自动装上的
重装pyim-basedict包吧
很好,那我就静待更新了。其实由子龙山人出面提交可能会更快通过。不过对我影响也不是很大,只不过更新包的时候需要跳过 chinese-pyim 的更新。
Edit:难道咱们看的不是同一个 github?为什么我看不到相关的 issue 和 PR?
噢终于发现因为 pyim-basedict 不在 melpa-stable 里……
顺便问一下改名后 api 修改得多嘛,我现在把配置里所有的 chinese-pyim 改成了 pyim 似乎并没有恢复我所有的配置
主要表现是好像打不出词了……字典都导入进来了,但打 nihao
时只能先选 你
再选 好
贴出你的配置看看,另外看看 pyim-extra-dicts的取值
;; {{ make IME compatible with evil-mode
(defun evil-toggle-input-method ()
"when toggle on input method, goto evil-insert-state. "
(interactive)
;; load IME when needed, less memory footprint
(unless (featurep 'pyim)
(require 'pyim))
;; some guy don't use evil-mode at all
(cond
((and (boundp 'evil-mode) evil-mode)
;; evil-mode
(cond
((eq evil-state 'insert)
(toggle-input-method))
(t
(evil-insert-state)
(unless current-input-method
(toggle-input-method))))
(if current-input-method (message "IME on!")))
(t
;; NOT evil-mode
(toggle-input-method))))
(defadvice evil-insert-state (around evil-insert-state-hack activate)
ad-do-it
(if current-input-method (message "IME on!")))
(global-set-key (kbd "C-\\") 'evil-toggle-input-method)
;; }}
(defvar my-pyim-directory
"~/.eim"
"There directory of peronsal dictionaries for chinese-pyim.")
(add-to-list 'auto-mode-alist '("\\.pyim\\'" . text-mode))
(defun my-pyim-personal-dict (&optional dict-name)
(file-truename (concat (file-name-as-directory my-pyim-directory)
(or dict-name "personal.pyim"))))
(defun my-pyim-export-dictionary ()
"Export words you use in chinese-pyim into personal dictionary."
(interactive)
(with-temp-buffer
(maphash
#'(lambda (key value)
;; only export two character word
(if (string-match "-" key)
(insert (concat key
" "
(mapconcat #'identity value ""))
"\n")))
pyim-dcache-icode2word)
(unless (and my-pyim-directory
(file-directory-p my-pyim-directory))
(setq my-pyim-directory
(read-directory-name "Personal Chinese dictionary directory:")))
(if my-pyim-directory
(write-file (my-pyim-personal-dict)))))
(eval-after-load 'pyim
'(progn
;; I'm OK with a smaller dictionary
(pyim-basedict-enable)
;; use western punctuation (ban jiao fu hao)
;; (setq pyim-punctuation-dict nil)
;; always input English when isearch
(setq pyim-isearch-enable-pinyin-search t)
(setq default-input-method "pyim")
;; re-order backends, I prefer less typing
(setq pyim-backends '(pinyin-shortcode
pinyin-znabc
dcache-personal
dcache-common
pinyin-chars))
;; use personal dictionary
(if (and my-pyim-directory
(file-exists-p (my-pyim-personal-dict)))
(add-to-list 'pyim-dicts (list :name "personal" :file (my-pyim-personal-dict))))
;; You can also set up the great dictionary (80M) the same way as peronsal dictionary
;; great dictionary can be downloaded this way:
;; `curl -L https://github.com/tumashu/chinese-pyim-greatdict/raw/master/pyim-greatdict.pyim.gz | zcat > ~/.eim/pyim-greatdict.pyim`
;; don't use tooltip
(setq pyim-use-tooltip 'popup)))
;; chinese-pyim
(defun pyim-probe-dynamic-english-custom ()
(let ((str-before-1 (pyim-char-before-to-string 0))
(str-before-2 (pyim-char-before-to-string 1)))
(unless (string= (buffer-name) " *temp*")
(if (> (point) (save-excursion (back-to-indentation)
(point)))
(or (if (pyim-string-match-p " " str-before-1)
(pyim-string-match-p "\\cc" str-before-2)
(and (not (pyim-string-match-p "\\cc" str-before-1))
(= (length pyim-entered-code) 0))))))))
(setq-default pyim-english-input-switch-functions
'(pyim-probe-dynamic-english-custom
pyim-probe-program-mode
pyim-probe-evil-normal-mode
))
(eval-after-load 'pyim
'(progn
(if (file-exists-p "~/.eim/dicts/pyim-bigdict.pyim")
(add-to-list 'pyim-dicts (list :name "bigdict" :file "~/.eim/dicts/pyim-bigdict.pyim")))))
去掉这个,这个接口我改过了,我正在考虑是否将 pyim-backends 设为一个 defvar 而不是 defcustom
;; *** 词条获取
;; pyim *内置* 了多种词条获取的方式:
;; 1. `personal-dcache-words' 从 `pyim-dcache-icode2word' 中获取词条。
;; 2. `common-dcache-words' 从 `pyim-dcache-code2word' 中获取词条。
;; 3. `pinyin-chars' 逐一获取一个拼音对应的多个汉字。
;; 4. `jianpin-words' 获取一个简拼对应的词条,
;; 如果输入 \"ni-hao\" ,那么同时搜索 code 为 \"n-h\" 的词条。
;; 5. `znabc-words' 类似智能ABC的词语获取方式(源于 emacs-eim)."
解决!感谢!
除了包的名字改动之外,有没有什么函数/变量名也改变了?
还有,你们都提到已经有人向 spacemacs 提交了 PR,但是我并没有看到? 如果没有的话我可以抽空提交一个。
pyim 有点像一个 python 的包名,
Edit: 还真有一个 Python 包叫这个名字 :
好像是用来对插入的 DNA 数据进行分析的
Maybe pinyin-im is a better choice? or just use chinese-pyim as a prefix instead?
我发现有很多变量名的改变,要是能有一个 changelog 就好了。
Edit:
我这里列了一个不完全列表: 注意:
- 这个表不是标准的 org 或 markdown 表格,这里只是为了显示方便。
- 我已经很长时间没有使用 pyim,所以下面表格列出的改变可能不是最近的升级/重命名造成的。
- 这没可能是一个完全的列表,欢迎补充。
|-------------------------------+-------------------------|
| deprecated | replacement |
|===============================+=========================|
| =pyim-use-tooltip= | =pyim-page-tooltip= |
|-------------------------------+-------------------------|
| =pyim-dicts-directory= | =pyim-directory= |
|-------------------------------+-------------------------|
| =pyim-personal-file= | =pyim-dcache-directory= |
| =pyim-property-file= | |
|-------------------------------+-------------------------|
| =pyim-dicts-manager-mode= | =pyim-dm-mode= |
|-------------------------------+-------------------------|
| =pyim-dicts-manager-mode-map= | =pyim-dm-mode-map= |
|-------------------------------+-------------------------|
@tumashu 帮忙看看有没有问题,没有问题的话我就提交了:
https://github.com/et2010/spacemacs/commit/f64e1485bed3543047ca2bb23f05a7d3f6ea3133