branch: externals/pyim commit e1aeac91ee18726603f31a8158a239aad6899526 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-punctuation-auto-half-width-p --- pyim-process.el | 10 ++-------- pyim-punctuation.el | 9 +++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pyim-process.el b/pyim-process.el index 1663875645..f4a24a4cf3 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -920,14 +920,8 @@ alist 列表。" ((pyim-punctuation-escape-p (char-before)) str) - ;; 当 `pyim-punctuation-half-width-functions' 中 - ;; 任意一个函数返回值为 t 时,插入英文标点。 - ((cl-some (lambda (x) - (if (functionp x) - (funcall x char) - nil)) - pyim-punctuation-half-width-functions) - str) + ;; 自动切换全角/半角标点符号。 + ((pyim-punctuation-auto-half-width-p char) str) ;; 当光标前面为英文标点时, 按 `pyim-outcome-trigger' ;; 对应的字符后, 自动将其转换为对应的中文标点。 diff --git a/pyim-punctuation.el b/pyim-punctuation.el index 3ace4e0bc0..6e4a806317 100644 --- a/pyim-punctuation.el +++ b/pyim-punctuation.el @@ -220,6 +220,15 @@ PUNCT-LIST 格式类似: (defun pyim-punctuation-escape-p (char) (member char pyim-punctuation-escape-list)) +(defun pyim-punctuation-auto-half-width-p (char) + "测试是否自动切换到半角标点符号。" + (cl-some (lambda (x) + (if (functionp x) + (funcall x char) + nil)) + pyim-punctuation-half-width-functions)) + + ;; * Footer (provide 'pyim-punctuation)