branch: externals/pyim commit 03ad867a555ef1163d5a97ea15ba09c76aa5d327 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
* pyim-cstring.el (pyim-cstring-to-codes): test string-distance exist before call it. --- pyim-cstring.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyim-cstring.el b/pyim-cstring.el index 7a8131e..08cbbdf 100644 --- a/pyim-cstring.el +++ b/pyim-cstring.el @@ -367,7 +367,9 @@ code-prefix)。当RETURN-LIST 设置为 t 时,返回一个 code list。" ;;拼音使用了多音字校正 (t (let ((codes (pyim-cstring-to-pinyin string nil "-" t nil t)) codes-sorted) - (if (< (length criteria) 1) + (if (or (< (length criteria) 1) + ;; Emacs 27.1 include `string-distance'. + (not (functionp 'string-distance))) codes ;; 将 所有 codes 与 criteria 字符串比对,选取相似度最高的一个 ;; code. 这种处理方式适合拼音输入法。