branch: externals/pyim commit e065decb5d47b07d54974a819cc4c9fd61e8fb24 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Depend emacs > 27.1 --- .github/workflows/test.yml | 2 +- pyim-common.el | 12 ++-------- pyim-page.el | 6 +---- pyim-probe.el | 14 +++++------- pyim-process.el | 3 --- pyim.el | 6 +---- tests/pyim-tests.el | 55 +++++++++++++++++++++------------------------- 7 files changed, 35 insertions(+), 63 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 689ea11ae2..3d43acb127 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - emacs_version: [25.1, 26.1, 27.1, 28.1, snapshot] + emacs_version: [27.1, 28.1, snapshot] steps: - uses: purcell/setup-emacs@master with: diff --git a/pyim-common.el b/pyim-common.el index b84b2ebfc1..082450c6f2 100644 --- a/pyim-common.el +++ b/pyim-common.el @@ -195,18 +195,10 @@ When CARE-FIRST-ONE is no-nil, ((a b c) (d e)) => (a d)." (setq unread-command-events nil)) (setq unread-command-events (if (characterp key) - ;; Emacs >= 27 support (no-record . EVENT), please read emacs - ;; commit: f13d97b4de02586cce49909aa2f3f51fcb5daa5f (Fix defining - ;; keyboard macros in CUA mode) - (cons (if (> emacs-major-version 26) - (cons 'no-record key) - key) - unread-command-events) + (cons (cons 'no-record key) unread-command-events) (append (cl-mapcan (lambda (e) - (list (if (> emacs-major-version 26) - (cons 'no-record e) - e))) + (list (cons 'no-record e))) (append key nil)) unread-command-events)))) diff --git a/pyim-page.el b/pyim-page.el index e9ac5c73f1..e5d828a3de 100644 --- a/pyim-page.el +++ b/pyim-page.el @@ -28,11 +28,7 @@ ;;; Code: ;; * 代码 :code: (require 'cl-lib) -;; Emacs 26.1 之前的版本无法安装 posframe. -(require 'posframe nil t) -;; popup 不是 gnu elpa 包,所以不应该在这里加载它,加载它是由于向后兼容的原因, -;; 未来可能删除。 -(require 'popup nil t) +(require 'posframe) (require 'pyim-common) (require 'pyim-process) diff --git a/pyim-probe.el b/pyim-probe.el index 35335775df..f9ac589301 100644 --- a/pyim-probe.el +++ b/pyim-probe.el @@ -80,8 +80,7 @@ "激活这个 pyim 探针函数后,可以解决 org-speed-commands 与 pyim 冲突问题。 用于:`pyim-english-input-switch-functions' 。" - (and (> emacs-major-version 25) - (string= major-mode "org-mode") + (and (string= major-mode "org-mode") (bolp) (looking-at org-heading-regexp) org-use-speed-commands)) @@ -185,13 +184,10 @@ (member (char-to-string char) puncts)))) (defun pyim-probe-org-latex-mode () - "org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入. - -FIXME: 这个 probe 在 Emacs 25 上运行可能存在问题。" - (when (and (> emacs-major-version 25) - (eq major-mode 'org-mode)) - (or (org-inside-LaTeX-fragment-p) - (org-inside-latex-macro-p)))) + "org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入." + (and (eq major-mode 'org-mode) + (or (org-inside-LaTeX-fragment-p) + (org-inside-latex-macro-p)))) (defun pyim-probe-exwm-xim-environment () "测试当前是否是 exwm-xim 输入法环境。 diff --git a/pyim-process.el b/pyim-process.el index 746f9a833e..9bbd1d83fe 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -81,9 +81,6 @@ entered (nihaom) 的第一个候选词。 :type '(choice (const nil) (repeat function))) -(define-obsolete-variable-alias - 'pyim-process-async-delay 'pyim-process--run-delay "5.0") - (defcustom pyim-process-run-delay 0.5 "延迟多少秒开始延迟获取词条。" :type 'integer) diff --git a/pyim.el b/pyim.el index fdff16cb1e..64ee881a0e 100644 --- a/pyim.el +++ b/pyim.el @@ -9,7 +9,7 @@ ;; URL: https://github.com/tumashu/pyim ;; Version: 5.2.9 ;; Keywords: convenience, Chinese, pinyin, input-method -;; Package-Requires: ((emacs "25.1") (async "1.6") (xr "1.13")) +;; Package-Requires: ((emacs "27.1") (async "1.6") (xr "1.13")) ;; This file is part of GNU Emacs. @@ -38,10 +38,6 @@ (require 'pyim-common) (require 'pyim-cstring) (require 'pyim-dhashcache) -;; NOTE: pyim 默认使用 dhashcache, 按理说不需要加载 dregcache, 但以前 pyim 支持 -;; 动态加载后端,由于简化代码的原因,这个功能取消了,require dregcache 是为了向 -;; 后兼容,未来也许会取消加载。 -(require 'pyim-dregcache) (require 'pyim-indicator) (require 'pyim-page) (require 'pyim-preview) diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el index b0e0083123..502b7f26d1 100644 --- a/tests/pyim-tests.el +++ b/tests/pyim-tests.el @@ -1600,17 +1600,16 @@ Transfer-Encoding: chunked (should (pyim-probe-isearch-mode)))) (ert-deftest pyim-tests-pyim-probe-org-speed-commands () - (when (> emacs-major-version 25) - (with-temp-buffer - (let ((org-use-speed-commands t)) - (org-mode) - (insert "* heading") - (goto-char (line-beginning-position)) - (should (pyim-probe-org-speed-commands)) - (forward-char 1) - (should-not (pyim-probe-org-speed-commands)) - (forward-char 1) - (should-not (pyim-probe-org-speed-commands)))))) + (with-temp-buffer + (let ((org-use-speed-commands t)) + (org-mode) + (insert "* heading") + (goto-char (line-beginning-position)) + (should (pyim-probe-org-speed-commands)) + (forward-char 1) + (should-not (pyim-probe-org-speed-commands)) + (forward-char 1) + (should-not (pyim-probe-org-speed-commands))))) (ert-deftest pyim-tests-pyim-probe-org-structure-template () (with-temp-buffer @@ -1703,25 +1702,21 @@ Transfer-Encoding: chunked (should (pyim-probe-punctuation-after-punctuation ?.)))) (ert-deftest pyim-tests-pyim-probe-org-latex-mode () - (when (> emacs-major-version 25) - (with-temp-buffer - (org-mode) - (insert "\\begin{equation}") - (save-excursion - (insert "\\end{equation}")) - (should (pyim-probe-org-latex-mode)) - - (erase-buffer) - (insert "$$") - (backward-char 1) - (should (pyim-probe-org-latex-mode)) - - (erase-buffer) - (insert "\\documentclass{article}") - (should (pyim-probe-org-latex-mode)))) - - (when (< emacs-major-version 26) - (should-not (pyim-probe-org-latex-mode)))) + (with-temp-buffer + (org-mode) + (insert "\\begin{equation}") + (save-excursion + (insert "\\end{equation}")) + (should (pyim-probe-org-latex-mode)) + + (erase-buffer) + (insert "$$") + (backward-char 1) + (should (pyim-probe-org-latex-mode)) + + (erase-buffer) + (insert "\\documentclass{article}") + (should (pyim-probe-org-latex-mode)))) (ert-deftest pyim-tests-pyim-probe-exwm-xim-environment () (with-temp-buffer