[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handl
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 952814a 1/2: * pyim.el (pyim-cregexp-build): handle the case, when regexp generated is too long. |
Date: |
Mon, 15 Mar 2021 03:57:09 -0400 (EDT) |
branch: externals/pyim
commit 952814aef12f8f6ef2432b577d2947d8edf30508
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* pyim.el (pyim-cregexp-build): handle the case, when regexp generated is
too long.
---
pyim.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/pyim.el b/pyim.el
index 1abbf09..c92362a 100644
--- a/pyim.el
+++ b/pyim.el
@@ -3847,14 +3847,19 @@ PUNCT-LIST 格式类似:
;; While I want (pyim-cregexp-build "") return just "".
(if (equal string "")
string
- (or (ignore-errors
- (rx-to-string (pyim-cregexp-build-from-rx
- (lambda (x)
- (if (stringp x)
- (xr (pyim-cregexp-build-1 x))
- x))
- (xr string))))
- string)))
+ (let ((rx-string (ignore-errors
+ (rx-to-string (pyim-cregexp-build-from-rx
+ (lambda (x)
+ (if (stringp x)
+ (xr (pyim-cregexp-build-1 x))
+ x))
+ (xr string))))))
+ (if (and rx-string
+ (stringp rx-string)
+ ;; FIXME: Emacs seem to can not handle regexp, which length is
too big.
+ (length< rx-string 5000))
+ rx-string
+ string))))
(defun pyim-cregexp-build-from-rx (fn rx-form)
(pcase rx-form