emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim aa07a23fda 39/41: * pyim-probe.el (pyim-probe-org-


From: ELPA Syncer
Subject: [elpa] externals/pyim aa07a23fda 39/41: * pyim-probe.el (pyim-probe-org-latex-mode): Update.
Date: Sat, 4 Jun 2022 09:57:48 -0400 (EDT)

branch: externals/pyim
commit aa07a23fda3f8b8c26b812ef35f455b7e7bf5a76
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    * pyim-probe.el (pyim-probe-org-latex-mode): Update.
---
 pyim-probe.el       | 11 +++++++----
 tests/pyim-tests.el | 34 +++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/pyim-probe.el b/pyim-probe.el
index 48d0c488d5..4d0e87bb77 100644
--- a/pyim-probe.el
+++ b/pyim-probe.el
@@ -184,10 +184,13 @@
          (member (char-to-string char) puncts))))
 
 (defun pyim-probe-org-latex-mode ()
-  "org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入."
-  (when (eq major-mode 'org-mode)
-    (or (not (eq (org-inside-LaTeX-fragment-p) nil))
-        (not (eq (org-inside-latex-macro-p) nil)))))
+  "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))))
 
 (defun pyim-probe-exwm-xim-environment ()
   "测试当前是否是 exwm-xim 输入法环境。
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 612df1dea4..66af353c9c 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -1457,21 +1457,25 @@ Transfer-Encoding: chunked
     (should (pyim-probe-punctuation-after-punctuation ?.))))
 
 (ert-deftest pyim-tests-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))))
+  (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))))
 
 (ert-deftest pyim-tests-pyim-probe-exwm-xim-environment ()
   (with-temp-buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]