[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 91c86e3a7c: pyim-cregexp.el do not require isearch
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 91c86e3a7c: pyim-cregexp.el do not require isearch. |
Date: |
Tue, 24 May 2022 16:57:57 -0400 (EDT) |
branch: externals/pyim
commit 91c86e3a7cad23bbd6310a69ac5bb3ee534811fb
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
pyim-cregexp.el do not require isearch.
* pyim.el (pyim-isearch-mode, ivy--regex-plus, pyim-cregexp-ivy,
pyim-isearch-search-fun): Added.
* pyim-cregexp.el (pyim-isearch-mode, pyim-cregexp-ivy,
ivy--regex-plus,
pyim-cregexp-isearch-search-fun): Removed.
cregexp 是 pyim 的一个核心,不应该有太多的依赖,特别是 isearch 这种用户交互工具。
---
pyim-cregexp.el | 49 ++++---------------------------------------------
pyim-probe.el | 3 ++-
pyim.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/pyim-cregexp.el b/pyim-cregexp.el
index b750a038e1..0dc6cdc38d 100644
--- a/pyim-cregexp.el
+++ b/pyim-cregexp.el
@@ -28,13 +28,12 @@
;;; Code:
;; * 代码 :code:
(require 'cl-lib)
-(when (>= emacs-major-version 26) (require 'isearch))
-(require 'xr)
-(require 'rx)
+(require 'pyim-dcache)
+(require 'pyim-imobjs)
(require 'pyim-pymap)
(require 'pyim-scheme)
-(require 'pyim-imobjs)
-(require 'pyim-dcache)
+(require 'rx)
+(require 'xr)
(defgroup pyim-cregexp nil
"Chinese regexp tools for pyim."
@@ -248,46 +247,6 @@ regexp, 所以搜索单字的时候一般可以搜到生僻字,但搜索句子
(window-minibuffer-p))
(exit-minibuffer))))
-(defun pyim-cregexp-isearch-search-fun ()
- "这个函数为 isearch 相关命令添加中文拼音搜索功能,
-做为 `isearch-search-fun' 函数的 advice 使用。"
- (funcall
- (lambda ()
- `(lambda (string &optional bound noerror count)
- (funcall (if ,isearch-forward
- 're-search-forward
- 're-search-backward)
- (pyim-cregexp-build string) bound noerror count)))))
-
-;;;###autoload
-(define-minor-mode pyim-isearch-mode
- "这个 mode 为 isearch 添加拼音搜索功能."
- :global t
- :require 'pyim
- :lighter " pyim-isearch"
- (if pyim-isearch-mode
- (progn
- (advice-add 'isearch-search-fun :override
#'pyim-cregexp-isearch-search-fun)
- (message "PYIM: `pyim-isearch-mode' 已经激活,激活后,一些 isearch 扩展包有可能失效。"))
- (advice-remove 'isearch-search-fun #'pyim-cregexp-isearch-search-fun)))
-
-(declare-function ivy--regex-plus "ivy")
-
-(defun pyim-cregexp-ivy (str)
- "Let ivy support search Chinese with pinyin feature."
- (let ((x (ivy--regex-plus str))
- (case-fold-search nil))
- (if (listp x)
- (mapcar (lambda (y)
- (if (cdr y)
- (list (if (equal (car y) "")
- ""
- (pyim-cregexp-build (car y)))
- (cdr y))
- (list (pyim-cregexp-build (car y)))))
- x)
- (pyim-cregexp-build x))))
-
;; * Footer
(provide 'pyim-cregexp)
diff --git a/pyim-probe.el b/pyim-probe.el
index 6d6574d14f..5d5c6e86f5 100644
--- a/pyim-probe.el
+++ b/pyim-probe.el
@@ -53,7 +53,8 @@
;;; Code:
;; * 代码 :code:
-(when (>= emacs-major-version 26) (require 'isearch))
+(when (>= emacs-major-version 26)
+ (require 'isearch))
(require 'pyim-common)
(require 'pyim-process)
diff --git a/pyim.el b/pyim.el
index 069d2897a1..30efc747fe 100644
--- a/pyim.el
+++ b/pyim.el
@@ -32,18 +32,18 @@
;; * 核心代码 :code:
;; ** require + defcustom + defvar
-(require 'subr-x)
(require 'cl-lib)
(require 'help-mode)
+(require 'pyim-autoselector)
(require 'pyim-common)
-(require 'pyim-scheme)
+(require 'pyim-cstring)
+(require 'pyim-dict)
+(require 'pyim-indicator)
(require 'pyim-page)
(require 'pyim-preview)
-(require 'pyim-indicator)
(require 'pyim-process)
-(require 'pyim-autoselector)
-(require 'pyim-cstring)
-(require 'pyim-dict)
+(require 'pyim-scheme)
+(require 'subr-x)
(defgroup pyim nil
"Pyim is a Chinese input method support quanpin, shuangpin, wubi and
cangjie."
@@ -850,6 +850,48 @@ FILE 的格式与 `pyim-dcache-export' 生成的文件格式相同,
;; ** pyim 中文 regexp 工具
(require 'pyim-cregexp)
+(when (>= emacs-major-version 26)
+ (require 'isearch))
+
+;;;###autoload
+(define-minor-mode pyim-isearch-mode
+ "这个 mode 为 isearch 添加拼音搜索功能."
+ :global t
+ :require 'pyim
+ :lighter " pyim-isearch"
+ (if pyim-isearch-mode
+ (progn
+ (advice-add 'isearch-search-fun :override #'pyim-isearch-search-fun)
+ (message "PYIM: `pyim-isearch-mode' 已经激活,激活后,一些 isearch 扩展包有可能失效。"))
+ (advice-remove 'isearch-search-fun #'pyim-isearch-search-fun)))
+
+(defun pyim-isearch-search-fun ()
+ "这个函数为 isearch 相关命令添加中文拼音搜索功能,
+做为 `isearch-search-fun' 函数的 advice 使用。"
+ (funcall
+ (lambda ()
+ `(lambda (string &optional bound noerror count)
+ (funcall (if ,isearch-forward
+ 're-search-forward
+ 're-search-backward)
+ (pyim-cregexp-build string) bound noerror count)))))
+
+(declare-function ivy--regex-plus "ivy")
+
+(defun pyim-cregexp-ivy (str)
+ "Let ivy support search Chinese with pinyin feature."
+ (let ((x (ivy--regex-plus str))
+ (case-fold-search nil))
+ (if (listp x)
+ (mapcar (lambda (y)
+ (if (cdr y)
+ (list (if (equal (car y) "")
+ ""
+ (pyim-cregexp-build (car y)))
+ (cdr y))
+ (list (pyim-cregexp-build (car y)))))
+ x)
+ (pyim-cregexp-build x))))
;; ** pyim 探针
(require 'pyim-probe)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/pyim 91c86e3a7c: pyim-cregexp.el do not require isearch.,
ELPA Syncer <=