Skip to content

Commit 5657f0d

Browse files
committed
chinese: remove ivy pinyin
1 parent 0927d28 commit 5657f0d

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

modules/h-cheung/chinese/config.el

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -153,53 +153,3 @@ input scheme to convert to Chinese."
153153
(when (featurep! +rime-predicates)
154154
(load! "+rime-predicates")))
155155

156-
157-
;; Support pinyin in Ivy
158-
;; Input prefix ';' to match pinyin
159-
;; Refer to https://github.com/abo-abo/swiper/issues/919 and
160-
;; https://github.com/pengpengxp/swiper/wiki/ivy-support-chinese-pinyin
161-
(use-package! pinyinlib
162-
:commands (pinyinlib-build-regexp-string)
163-
:init
164-
(with-no-warnings
165-
(defun ivy--regex-pinyin (str)
166-
"The regex builder wrapper to support pinyin."
167-
(or (pinyin-to-utf8 str)
168-
(and (fboundp '+ivy-prescient-non-fuzzy)
169-
(+ivy-prescient-non-fuzzy str))
170-
(ivy--regex-plus str)))
171-
172-
(defun my-pinyinlib-build-regexp-string (str)
173-
"Build a pinyin regexp sequence from STR."
174-
(cond ((equal str ".*") ".*")
175-
(t (pinyinlib-build-regexp-string str t))))
176-
177-
(defun my-pinyin-regexp-helper (str)
178-
"Construct pinyin regexp for STR."
179-
(cond ((equal str " ") ".*")
180-
((equal str "") nil)
181-
(t str)))
182-
183-
(defun pinyin-to-utf8 (str)
184-
"Convert STR to UTF-8."
185-
(cond ((equal 0 (length str)) nil)
186-
((equal (substring str 0 1) ";")
187-
(mapconcat
188-
#'my-pinyinlib-build-regexp-string
189-
(remove nil (mapcar
190-
#'my-pinyin-regexp-helper
191-
(split-string
192-
(replace-regexp-in-string ";" "" str)
193-
"")))
194-
""))
195-
(t nil)))
196-
197-
(mapcar
198-
(lambda (item)
199-
(let ((key (car item))
200-
(value (cdr item)))
201-
(when (member value '(+ivy-prescient-non-fuzzy
202-
ivy--regex-plus))
203-
(setf (alist-get key ivy-re-builders-alist)
204-
#'ivy--regex-pinyin))))
205-
ivy-re-builders-alist)))

0 commit comments

Comments
 (0)