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

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

[elpa] externals/pyim 19b69679d0: Add pyim-cregexp--match-error-p


From: ELPA Syncer
Subject: [elpa] externals/pyim 19b69679d0: Add pyim-cregexp--match-error-p
Date: Thu, 9 Mar 2023 02:58:25 -0500 (EST)

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

    Add pyim-cregexp--match-error-p
---
 pyim-cregexp.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/pyim-cregexp.el b/pyim-cregexp.el
index bd40e38216..4d20ba482b 100644
--- a/pyim-cregexp.el
+++ b/pyim-cregexp.el
@@ -124,10 +124,16 @@ regexp, 所以搜索单字的时候一般可以搜到生僻字,但搜索句子
   "Return t when cregexp is a valid regexp."
   (and cregexp
        (stringp cregexp)
-       (condition-case nil
-           (progn (string-match-p cregexp "") t)
-         ;; FIXME: Emacs can't handle regexps whose length is too big :-(
-         (error nil))))
+       (not (pyim-cregexp--match-error-p cregexp))))
+
+(defun pyim-cregexp--match-error-p (cregexp)
+  "Return t when an match error is signaled.
+
+Emacs can't handle regexps whose length is too big :-("
+  (equal (condition-case nil
+             (string-match-p cregexp "")
+           (error 'error))
+         'error))
 
 (defun pyim-cregexp--create-beautiful-cregexp-from-string
     (string scheme &optional char-level-num chinese-only)



reply via email to

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