[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 88307d3: Remove # before the lambda.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 88307d3: Remove # before the lambda. |
Date: |
Fri, 23 Apr 2021 02:57:10 -0400 (EDT) |
branch: externals/pyim
commit 88307d319368a6cd8fd6717edba6e1956c11f479
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Remove # before the lambda.
---
README.org | 2 +-
pyim-candidates.el | 8 +--
pyim-codes.el | 28 ++++-----
pyim-cregexp.el | 26 ++++----
pyim-cstring.el | 74 +++++++++++-----------
pyim-dcache.el | 10 +--
pyim-dhashcache.el | 178 ++++++++++++++++++++++++++---------------------------
pyim-dregcache.el | 66 ++++++++++----------
pyim-entered.el | 8 +--
pyim-outcome.el | 8 +--
pyim-page.el | 28 ++++-----
pyim-pinyin.el | 22 +++----
pyim-preview.el | 4 +-
pyim-probe.el | 4 +-
pyim.el | 12 ++--
15 files changed, 239 insertions(+), 239 deletions(-)
diff --git a/README.org b/README.org
index 51f0ad0..bbe5c1d 100644
--- a/README.org
+++ b/README.org
@@ -456,7 +456,7 @@ E-Neo 同学编写了一个词库转换工具: [[https://github.com/E-Neo/scel2p
#+begin_example
(add-hook 'emacs-startup-hook
- #'(lambda () (pyim-restart-1 t)))
+ (lambda () (pyim-restart-1 t)))
#+end_example
*** 将汉字字符串转换为拼音字符串
diff --git a/pyim-candidates.el b/pyim-candidates.el
index 835e737..eea09a6 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -87,12 +87,12 @@ IMOBJS 获得候选词条。"
(when output2
(setq str (mapconcat
- #'(lambda (code)
- (car (pyim-dcache-get code)))
+ (lambda (code)
+ (car (pyim-dcache-get code)))
output2 "")))
(setq output3
- (remove "" (or (mapcar #'(lambda (x)
- (concat str x))
+ (remove "" (or (mapcar (lambda (x)
+ (concat str x))
(pyim-dcache-get output1 '(code2word
shortcode2word icode2word)))
(list str))))
(setq result (append result output3))))
diff --git a/pyim-codes.el b/pyim-codes.el
index d557c2f..f8c8b71 100644
--- a/pyim-codes.el
+++ b/pyim-codes.el
@@ -51,12 +51,12 @@
(\"wo\" \"ai\" \"mei\" \"nv\")"
(mapcar
- #'(lambda (w)
- (let ((py (replace-regexp-in-string ;去掉分隔符,在词库中搜索候选词不需要分隔符
- "'" "" (concat (nth 0 w) (nth 1 w)))))
- (if (numberp first-n)
- (substring py 0 (min first-n (length py)))
- py)))
+ (lambda (w)
+ (let ((py (replace-regexp-in-string ;去掉分隔符,在词库中搜索候选词不需要分隔符
+ "'" "" (concat (nth 0 w) (nth 1 w)))))
+ (if (numberp first-n)
+ (substring py 0 (min first-n (length py)))
+ py)))
imobj))
(defun pyim-codes-create:shuangpin (imobj _scheme-name &optional first-n)
@@ -66,11 +66,11 @@
(when scheme-name
(let ((code-prefix (pyim-scheme-get-option scheme-name :code-prefix)))
(mapcar
- #'(lambda (x)
- (concat (or code-prefix "")
- (if (numberp first-n)
- (substring x 0 (min first-n (length x)))
- x)))
+ (lambda (x)
+ (concat (or code-prefix "")
+ (if (numberp first-n)
+ (substring x 0 (min first-n (length x)))
+ x)))
imobj))))
(defun pyim-code-search (word scheme-name)
@@ -82,11 +82,11 @@
(let* ((prefix (pyim-scheme-get-option scheme-name :code-prefix))
(code
(cl-find-if
- #'(lambda (x)
- (equal (substring (or x " ") 0 1) prefix))
+ (lambda (x)
+ (equal (substring (or x " ") 0 1) prefix))
(sort
(cl-copy-list (pyim-dcache-call-api 'search-word-code word))
- #'(lambda (a b) (> (length a) (length b)))))))
+ (lambda (a b) (> (length a) (length b)))))))
(substring (or code " ") 1))))
;; * Footer
diff --git a/pyim-cregexp.el b/pyim-cregexp.el
index ef24211..9d56ec9 100644
--- a/pyim-cregexp.el
+++ b/pyim-cregexp.el
@@ -116,10 +116,10 @@
(imobjs (pyim-imobjs-create string1 scheme-name))
(regexp-list
(mapcar
- #'(lambda (imobj)
- (if (eq class 'xingma)
- (pyim-cregexp-build:xingma imobj nil nil nil
code-prefix)
- (pyim-cregexp-build:quanpin imobj nil nil nil
char-level-num)))
+ (lambda (imobj)
+ (if (eq class 'xingma)
+ (pyim-cregexp-build:xingma imobj nil nil nil
code-prefix)
+ (pyim-cregexp-build:quanpin imobj nil nil nil
char-level-num)))
imobjs))
(regexp
(when regexp-list
@@ -139,8 +139,8 @@
first-equal all-equal char-level-num)
"从 IMOBJ 创建一个搜索中文的 regexp."
(let* ((imobj
- (mapcar #'(lambda (x)
- (concat (nth 0 x) (nth 1 x)))
+ (mapcar (lambda (x)
+ (concat (nth 0 x) (nth 1 x)))
imobj))
(cchar-list
(let ((n 0) results)
@@ -151,18 +151,18 @@
(cchars
;; 只取常用字,不常用的汉字忽略,防止生成的
;; regexp 太长而无法搜索
- (mapconcat #'(lambda (x)
- (mapconcat #'identity
- (cl-subseq (split-string x
"|") 0 char-level-num)
- ""))
+ (mapconcat (lambda (x)
+ (mapconcat #'identity
+ (cl-subseq (split-string x "|")
0 char-level-num)
+ ""))
(pyim-pymap-py2cchar-get py equal-match nil
t) "")))
(push cchars results))
(setq n (+ 1 n)))
(nreverse results)))
(regexp
- (mapconcat #'(lambda (x)
- (when (pyim-string-match-p "\\cc" x)
- (format "[%s]" x)))
+ (mapconcat (lambda (x)
+ (when (pyim-string-match-p "\\cc" x)
+ (format "[%s]" x)))
cchar-list "")))
(unless (equal regexp "")
(concat (if match-beginning "^" "") regexp))))
diff --git a/pyim-cstring.el b/pyim-cstring.el
index 920072e..27cdfa9 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -120,13 +120,13 @@
;; 是否冲突,如果冲突,仅保留一个,
;; 删除其它。
result
- :test #'(lambda (x1 x2)
- (let ((begin1 (nth 1 x1))
- (begin2 (nth 1 x2))
- (end1 (nth 2 x1))
- (end2 (nth 2 x2)))
- (not (or (<= end1 begin2)
- (<= end2 begin1)))))
+ :test (lambda (x1 x2)
+ (let ((begin1 (nth 1 x1))
+ (begin2 (nth 1 x2))
+ (end1 (nth 2 x1))
+ (end2 (nth 2 x2)))
+ (not (or (<= end1 begin2)
+ (<= end2 begin1)))))
:from-end prefer-short-word)
result))))
@@ -153,12 +153,12 @@
"@@@@")
(list string))))
(mapconcat
- #'(lambda (str)
- (when (> (length str) 0)
- (if (not (pyim-string-match-p "\\CC" str))
- (pyim-cstring-split-to-string-1
- str prefer-short-word separator max-word-length)
- (concat " " str " "))))
+ (lambda (str)
+ (when (> (length str) 0)
+ (if (not (pyim-string-match-p "\\CC" str))
+ (pyim-cstring-split-to-string-1
+ str prefer-short-word separator max-word-length)
+ (concat " " str " "))))
string-list "")))
(defun pyim-cstring-split-to-string-1 (chinese-string &optional
prefer-short-word
@@ -243,19 +243,19 @@ BUG: 当 STRING 中包含其它标点符号,并且设置 SEPERATER 时,结
;; 将上述汉字字符串里面的所有汉字转换为与之对应的拼音list。
;; 比如: ("Hello" "银" "行") -> (("Hello") ("yin") ("hang" "xing"))
(mapc
- #'(lambda (str)
- ;; `string-to-vector' 得到的是 char vector, 需要将其转换为 string。
- (when (numberp str)
- (setq str (char-to-string str)))
- (cond
- ((> (length str) 1)
- (push (list str) pinyins-list))
- ((and (> (length str) 0)
- (pyim-string-match-p "\\cc" str))
- (push (pyim-pymap-cchar2py-get (string-to-char str))
- pinyins-list))
- ((> (length str) 0)
- (push (list str) pinyins-list))))
+ (lambda (str)
+ ;; `string-to-vector' 得到的是 char vector, 需要将其转换为 string。
+ (when (numberp str)
+ (setq str (char-to-string str)))
+ (cond
+ ((> (length str) 1)
+ (push (list str) pinyins-list))
+ ((and (> (length str) 0)
+ (pyim-string-match-p "\\cc" str))
+ (push (pyim-pymap-cchar2py-get (string-to-char str))
+ pinyins-list))
+ ((> (length str) 0)
+ (push (list str) pinyins-list))))
string-list)
(setq pinyins-list (nreverse pinyins-list))
@@ -284,13 +284,13 @@ BUG: 当 STRING 中包含其它标点符号,并且设置 SEPERATER 时,结
(or pinyins-list-adjusted
pinyins-list-permutated))
(list (mapcar
- #'(lambda (x)
- (mapconcat
- #'(lambda (str)
- (if shou-zi-mu
- (substring str 0 1)
- str))
- x separator))
+ (lambda (x)
+ (mapconcat
+ (lambda (str)
+ (if shou-zi-mu
+ (substring str 0 1)
+ str))
+ x separator))
(if ignore-duo-yin-zi
(list (car pinyins-list))
pinyins-list))))
@@ -426,8 +426,8 @@ code-prefix)。当RETURN-LIST 设置为 t 时,返回一个 code list。"
(let* ((words (pyim-cstring-words-at-point t))
(max-length
(cl-reduce #'max
- (cons 0 (mapcar #'(lambda (word)
- (nth 2 word))
+ (cons 0 (mapcar (lambda (word)
+ (nth 2 word))
words))))
(max-length (max (or max-length 1) 1)))
(forward-char max-length))))
@@ -441,8 +441,8 @@ code-prefix)。当RETURN-LIST 设置为 t 时,返回一个 code list。"
(let* ((words (pyim-cstring-words-at-point))
(max-length
(cl-reduce #'max
- (cons 0 (mapcar #'(lambda (word)
- (nth 1 word))
+ (cons 0 (mapcar (lambda (word)
+ (nth 1 word))
words))))
(max-length (max (or max-length 1) 1)))
(backward-char max-length))))
diff --git a/pyim-dcache.el b/pyim-dcache.el
index ad6d0c9..c96a6d1 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -167,8 +167,8 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
(defun pyim-dcache-create-dicts-md5 (dict-files)
(let* ((version "v1") ;当需要强制更新 dict 缓存时,更改这个字符串。
(dicts-md5 (md5 (prin1-to-string
- (mapcar #'(lambda (file)
- (list version file (nth 5
(file-attributes file 'string))))
+ (mapcar (lambda (file)
+ (list version file (nth 5 (file-attributes
file 'string))))
dict-files)))))
dicts-md5))
@@ -179,9 +179,9 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
词库缓冲文件,然后加载词库缓存。
如果 FORCE 为真,强制加载。"
- (let* ((dict-files (mapcar #'(lambda (x)
- (unless (plist-get x :disable)
- (plist-get x :file)))
+ (let* ((dict-files (mapcar (lambda (x)
+ (unless (plist-get x :disable)
+ (plist-get x :file)))
`(,@pyim-dicts ,@pyim-extra-dicts)))
(dicts-md5 (pyim-dcache-create-dicts-md5 dict-files)))
(pyim-dcache-call-api 'update-code2word dict-files dicts-md5 force)))
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 333cdaf..fd01087 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -54,9 +54,9 @@
排序使用 `pyim-dhashcache-iword2count' 中记录的词频信息"
(sort words-list
- #'(lambda (a b)
- (> (or (gethash a pyim-dhashcache-iword2count) 0)
- (or (gethash b pyim-dhashcache-iword2count) 0)))))
+ (lambda (a b)
+ (> (or (gethash a pyim-dhashcache-iword2count) 0)
+ (or (gethash b pyim-dhashcache-iword2count) 0)))))
(defun pyim-dhashcache-get-shortcode (code)
"获取一个 CODE 的所有简写.
@@ -84,21 +84,21 @@
(make-thread
`(lambda ()
(maphash
- #'(lambda (key value)
- (let ((newkey (mapconcat
- #'(lambda (x)
- (substring x 0 1))
- (split-string key "-") "-")))
- (puthash newkey
- (delete-dups
- `(,@value
- ,@(gethash newkey
pyim-dhashcache-ishortcode2word)))
- pyim-dhashcache-ishortcode2word)))
+ (lambda (key value)
+ (let ((newkey (mapconcat
+ (lambda (x)
+ (substring x 0 1))
+ (split-string key "-") "-")))
+ (puthash newkey
+ (delete-dups
+ `(,@value
+ ,@(gethash newkey
pyim-dhashcache-ishortcode2word)))
+ pyim-dhashcache-ishortcode2word)))
pyim-dhashcache-icode2word)
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-ishortcode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-ishortcode2word))
pyim-dhashcache-ishortcode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-ishortcode2word)
(setq pyim-dhashcache-update-ishortcode2word t)))
@@ -113,23 +113,23 @@
(setq pyim-dhashcache-ishortcode2word
(make-hash-table :test #'equal))
(maphash
- #'(lambda (key value)
- (when (and (> (length key) 0)
- (not (string-match-p "[^a-z-]" key)))
- (let* ((newkey (mapconcat
- #'(lambda (x)
- (substring x 0 1))
- (split-string key "-") "-")))
- (puthash newkey
- (delete-dups
- `(,@value
- ,@(gethash newkey
pyim-dhashcache-ishortcode2word)))
- pyim-dhashcache-ishortcode2word))))
+ (lambda (key value)
+ (when (and (> (length key) 0)
+ (not (string-match-p "[^a-z-]" key)))
+ (let* ((newkey (mapconcat
+ (lambda (x)
+ (substring x 0 1))
+ (split-string key "-") "-")))
+ (puthash newkey
+ (delete-dups
+ `(,@value
+ ,@(gethash newkey
pyim-dhashcache-ishortcode2word)))
+ pyim-dhashcache-ishortcode2word))))
pyim-dhashcache-icode2word)
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-ishortcode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-ishortcode2word))
pyim-dhashcache-ishortcode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-ishortcode2word))
`(lambda (result)
@@ -146,21 +146,21 @@
(make-thread
`(lambda ()
(maphash
- #'(lambda (key value)
- (dolist (x (pyim-dhashcache-get-shortcode key))
- (puthash x
- (mapcar
- #'(lambda (word)
- (if (get-text-property 0 :comment word)
- word
- (propertize word :comment (substring key
(length x)))))
- (delete-dups `(,@value ,@(gethash x
pyim-dhashcache-shortcode2word))))
- pyim-dhashcache-shortcode2word)))
+ (lambda (key value)
+ (dolist (x (pyim-dhashcache-get-shortcode key))
+ (puthash x
+ (mapcar
+ (lambda (word)
+ (if (get-text-property 0 :comment word)
+ word
+ (propertize word :comment (substring key
(length x)))))
+ (delete-dups `(,@value ,@(gethash x
pyim-dhashcache-shortcode2word))))
+ pyim-dhashcache-shortcode2word)))
pyim-dhashcache-code2word)
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-shortcode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-shortcode2word))
pyim-dhashcache-shortcode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-shortcode2word)
(setq pyim-dhashcache-update-shortcode2word t)))
@@ -175,26 +175,26 @@
(setq pyim-dhashcache-shortcode2word
(make-hash-table :test #'equal))
(maphash
- #'(lambda (key value)
- (dolist (x (pyim-dhashcache-get-shortcode key))
- (puthash x
- (mapcar
- #'(lambda (word)
- ;; 这个地方的代码用于实现五笔 code 自动提示功能,
- ;; 比如输入 'aa' 后得到选词框:
- ;; ----------------------
- ;; | 1. 莁aa 2.匶wv ... |
- ;; ----------------------
- (if (get-text-property 0 :comment word)
- word
- (propertize word :comment (substring key
(length x)))))
- (delete-dups `(,@value ,@(gethash x
pyim-dhashcache-shortcode2word))))
- pyim-dhashcache-shortcode2word)))
+ (lambda (key value)
+ (dolist (x (pyim-dhashcache-get-shortcode key))
+ (puthash x
+ (mapcar
+ (lambda (word)
+ ;; 这个地方的代码用于实现五笔 code 自动提示功能,
+ ;; 比如输入 'aa' 后得到选词框:
+ ;; ----------------------
+ ;; | 1. 莁aa 2.匶wv ... |
+ ;; ----------------------
+ (if (get-text-property 0 :comment word)
+ word
+ (propertize word :comment (substring key (length
x)))))
+ (delete-dups `(,@value ,@(gethash x
pyim-dhashcache-shortcode2word))))
+ pyim-dhashcache-shortcode2word)))
pyim-dhashcache-code2word)
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-shortcode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-shortcode2word))
pyim-dhashcache-shortcode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-shortcode2word)
nil)
@@ -245,15 +245,15 @@ DCACHE 是一个 code -> words 的 hashtable.
(when (hash-table-p dcache)
(let ((hashtable (make-hash-table :size 1000000 :test #'equal)))
(maphash
- #'(lambda (code words)
- (unless (pyim-string-match-p "-" code)
- (dolist (word words)
- (let ((value (gethash word hashtable)))
- (puthash word
- (if value
- `(,code ,@value)
- (list code))
- hashtable)))))
+ (lambda (code words)
+ (unless (pyim-string-match-p "-" code)
+ (dolist (word words)
+ (let ((value (gethash word hashtable)))
+ (puthash word
+ (if value
+ `(,code ,@value)
+ (list code))
+ hashtable)))))
dcache)
(pyim-dcache-save-value-to-file hashtable file))))
@@ -299,12 +299,12 @@ DCACHE 是一个 code -> words 的 hashtable.
(with-temp-buffer
(insert ";;; -*- coding: utf-8-unix -*-\n")
(maphash
- #'(lambda (key value)
- (insert (format "%s %s\n"
- key
- (if (listp value)
- (mapconcat #'identity value " ")
- value))))
+ (lambda (key value)
+ (insert (format "%s %s\n"
+ key
+ (if (listp value)
+ (mapconcat #'identity value " ")
+ value))))
dcache)
(pyim-dcache-write-file file confirm)))
@@ -344,9 +344,9 @@ code 对应的中文词条了。
(make-thread
`(lambda ()
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-icode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-icode2word))
pyim-dhashcache-icode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-icode2word)
(setq pyim-dhashcache-update-icode2word-p t)))
@@ -359,9 +359,9 @@ code 对应的中文词条了。
(pyim-dcache-set-variable 'pyim-dhashcache-icode2word)
(pyim-dcache-set-variable 'pyim-dhashcache-iword2count)
(maphash
- #'(lambda (key value)
- (puthash key (pyim-dhashcache-sort-words value)
- pyim-dhashcache-icode2word))
+ (lambda (key value)
+ (puthash key (pyim-dhashcache-sort-words value)
+ pyim-dhashcache-icode2word))
pyim-dhashcache-icode2word)
(pyim-dcache-save-variable 'pyim-dhashcache-icode2word)
nil)
@@ -402,18 +402,18 @@ code 对应的中文词条了。
(defun pyim-dhashcache-insert-export-content ()
(maphash
- #'(lambda (key value)
- (insert (format "%s %s\n" key value)))
+ (lambda (key value)
+ (insert (format "%s %s\n" key value)))
pyim-dhashcache-iword2count)
;; 在默认情况下,用户选择过的词生成的缓存中存在的词条,
;; `pyim-dhashcache-iword2count' 中也一定存在,但如果用户
;; 使用了特殊的方式给用户选择过的词生成的缓存中添加了
;; 词条,那么就需要将这些词条也导出,且设置词频为 0
(maphash
- #'(lambda (_ words)
- (dolist (word words)
- (unless (gethash word pyim-dhashcache-iword2count)
- (insert (format "%s %s\n" word 0)))))
+ (lambda (_ words)
+ (dolist (word words)
+ (unless (gethash word pyim-dhashcache-iword2count)
+ (insert (format "%s %s\n" word 0)))))
pyim-dhashcache-icode2word))
(defmacro pyim-dhashcache-put (cache code &rest body)
diff --git a/pyim-dregcache.el b/pyim-dregcache.el
index 3740837..475deb2 100644
--- a/pyim-dregcache.el
+++ b/pyim-dregcache.el
@@ -72,11 +72,11 @@
排序使用 `pyim-dregcache-iword2count' 中记录的词频信息"
(sort words-list
- #'(lambda (a b)
- (let ((a (car (split-string a ":")))
- (b (car (split-string b ":"))))
- (> (or (gethash a pyim-dregcache-iword2count) 0)
- (or (gethash b pyim-dregcache-iword2count) 0))))))
+ (lambda (a b)
+ (let ((a (car (split-string a ":")))
+ (b (car (split-string b ":"))))
+ (> (or (gethash a pyim-dregcache-iword2count) 0)
+ (or (gethash b pyim-dregcache-iword2count) 0))))))
(defun pyim-dregcache-sort-icode2word ()
"对个人词库排序."
@@ -84,18 +84,18 @@
(with-temp-buffer
(dolist (l (split-string pyim-dregcache-icode2word "\n"))
(cond
- ((string-match "^\\([a-z-]+ \\)\\(.*\\)" l)
- ;; 3字以上词很少,如果只处理单字,2字词,3字词
- ;; ((string-match "^\\([a-z]+ \\|[a-z]+-[a-z]+
\\|[a-z]+-[a-z]+-[a-z]+ \\)\\(.*\\)" l)
- (let* ((pinyin (match-string 1 l))
- (words (pyim-dregcache-sort-words (split-string (match-string
2 l) " "))))
- (insert (format "%s\n" (concat pinyin (mapconcat #'identity words "
"))))))
- ;; 其他词
- ((string= l "")
- ;; skip empty line
- )
- (t
- (insert (format "%s\n" l)))))
+ ((string-match "^\\([a-z-]+ \\)\\(.*\\)" l)
+ ;; 3字以上词很少,如果只处理单字,2字词,3字词
+ ;; ((string-match "^\\([a-z]+ \\|[a-z]+-[a-z]+ \\|[a-z]+-[a-z]+-[a-z]+
\\)\\(.*\\)" l)
+ (let* ((pinyin (match-string 1 l))
+ (words (pyim-dregcache-sort-words (split-string (match-string 2
l) " "))))
+ (insert (format "%s\n" (concat pinyin (mapconcat #'identity words "
"))))))
+ ;; 其他词
+ ((string= l "")
+ ;; skip empty line
+ )
+ (t
+ (insert (format "%s\n" l)))))
(setq pyim-dregcache-icode2word (buffer-string))))
(defun pyim-dregcache-create-cache-content (raw-content)
@@ -376,17 +376,17 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
(let* ((case-fold-search t)
substring beg end)
(while (re-search-forward (concat "^\\([a-z-]+\\) \\(.*\\)" word
"\\(.*\\)$") nil t)
- (setq beg (match-beginning 0))
- (setq end (match-end 0))
- (setq substring (concat (match-string-no-properties 1)
- (match-string-no-properties 2)
- (match-string-no-properties 3)))
-
- ;; delete string and the newline char
- (delete-region beg (+ 1 end))
- (when (> (length (split-string substring " ")) 1)
- (goto-char beg)
- (insert substring)))
+ (setq beg (match-beginning 0))
+ (setq end (match-end 0))
+ (setq substring (concat (match-string-no-properties 1)
+ (match-string-no-properties 2)
+ (match-string-no-properties 3)))
+
+ ;; delete string and the newline char
+ (delete-region beg (+ 1 end))
+ (when (> (length (split-string substring " ")) 1)
+ (goto-char beg)
+ (insert substring)))
(setq pyim-dregcache-icode2word
(buffer-string))))
;; 删除对应词条的词频
@@ -418,13 +418,13 @@ DICT-FILES 是词库文件列表. DICTS-MD5 是词库的MD5校验码.
(goto-char (or beg (point-max)))
(insert replace-string))
(setq pyim-dregcache-icode2word
- (buffer-string))))
+ (buffer-string))))
(defun pyim-dregcache-search-word-code-1 (word content)
- (let* ((case-fold-search t)
- (regexp (concat "^\\([a-z-]+\\)\\(.*\\) " "\\(" word " \\|" word
"$\\)")))
- (when (string-match regexp content)
- (match-string-no-properties 1 content))))
+ (let* ((case-fold-search t)
+ (regexp (concat "^\\([a-z-]+\\)\\(.*\\) " "\\(" word " \\|" word
"$\\)")))
+ (when (string-match regexp content)
+ (match-string-no-properties 1 content))))
(defun pyim-dregcache-search-word-code (word)
"从 `pyim-dregcache-cache' 和 `pyim-dregcache-icode2word' 搜索 word, 得到对应的code."
diff --git a/pyim-entered.el b/pyim-entered.el
index a21dee8..130db63 100644
--- a/pyim-entered.el
+++ b/pyim-entered.el
@@ -195,10 +195,10 @@ TYPE 取值为 point-after, 返回 entered buffer 中 point 之后的字符
(pyim-candidates-create-timer-function)))))
;; 自动上屏功能
(let ((autoselector-results
- (mapcar #'(lambda (x)
- (when (functionp x)
- (ignore-errors
- (funcall x))))
+ (mapcar (lambda (x)
+ (when (functionp x)
+ (ignore-errors
+ (funcall x))))
(cl-remove-duplicates pyim-autoselector :from-end t)))
result)
(cond
diff --git a/pyim-outcome.el b/pyim-outcome.el
index b5700cb..7e4d1ac 100644
--- a/pyim-outcome.el
+++ b/pyim-outcome.el
@@ -253,10 +253,10 @@ alist 列表。"
;; 当 `pyim-punctuation-half-width-functions' 中
;; 任意一个函数返回值为 t 时,插入英文标点。
- ((cl-some #'(lambda (x)
- (if (functionp x)
- (funcall x char)
- nil))
+ ((cl-some (lambda (x)
+ (if (functionp x)
+ (funcall x char)
+ nil))
pyim-punctuation-half-width-functions)
str)
diff --git a/pyim-page.el b/pyim-page.el
index 5d2a625..996c53f 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -178,11 +178,11 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(start (1- (pyim-page-start)))
(candidates pyim-candidates)
(candidate-showed
- (mapcar #'(lambda (x)
- (let ((comment (get-text-property 0 :comment x)))
- (if comment
- (concat x comment)
- x)))
+ (mapcar (lambda (x)
+ (let ((comment (get-text-property 0 :comment x)))
+ (if comment
+ (concat x comment)
+ x)))
(cl-subseq candidates start end)))
(pos (- (min pyim-candidate-position (length candidates)) start))
(page-info (make-hash-table)))
@@ -283,8 +283,8 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(let* ((separator (or separator " "))
(translated (mapconcat #'identity
(mapcar
- #'(lambda (w)
- (concat (nth 0 w) (nth 1 w)))
+ (lambda (w)
+ (concat (nth 0 w) (nth 1 w)))
(car pyim-imobjs))
separator)))
(concat
@@ -316,15 +316,15 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(push (car (rassoc (list ym) keymaps)) result)
(push
(concat (cl-some
- #'(lambda (x)
- (when (equal sm (nth 1 x))
- (car x)))
+ (lambda (x)
+ (when (equal sm (nth 1 x))
+ (car x)))
keymaps)
(cl-some
- #'(lambda (x)
- (when (or (equal ym (nth 2 x))
- (equal ym (nth 3 x)))
- (car x)))
+ (lambda (x)
+ (when (or (equal ym (nth 2 x))
+ (equal ym (nth 3 x)))
+ (car x)))
keymaps))
result))))
(mapconcat #'identity
diff --git a/pyim-pinyin.el b/pyim-pinyin.el
index d66ef03..ecfa1cd 100644
--- a/pyim-pinyin.el
+++ b/pyim-pinyin.el
@@ -85,13 +85,13 @@
(count 0))
(concat (if match-beginning "^" "")
(mapconcat
- #'(lambda (x)
- (setq count (+ count 1))
- (if (or (not first-equal) (> count 1))
- (if all-equal
- x
- (concat x "[a-z]*"))
- x))
+ (lambda (x)
+ (setq count (+ count 1))
+ (if (or (not first-equal) (> count 1))
+ (if all-equal
+ x
+ (concat x "[a-z]*"))
+ x))
pinyin-list "-")))))
;; 分解拼音的相关函数
@@ -118,10 +118,10 @@
(cl-flet ((pinyin-valid-p
(shenmu yunmu)
(cl-some
- #'(lambda (char-pinyin)
- (pyim-pymap-py2cchar-get char-pinyin t))
- (mapcar #'(lambda (x)
- (concat (nth 0 x) (nth 1 x)))
+ (lambda (char-pinyin)
+ (pyim-pymap-py2cchar-get char-pinyin t))
+ (mapcar (lambda (x)
+ (concat (nth 0 x) (nth 1 x)))
(pyim-imobjs-find-fuzzy:quanpin-1
(list shenmu yunmu shenmu yunmu))))))
(while (> i 0)
diff --git a/pyim-preview.el b/pyim-preview.el
index edcac84..6b93f4a 100644
--- a/pyim-preview.el
+++ b/pyim-preview.el
@@ -77,8 +77,8 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示
(pyim-candidate-parse (nth pos candidates)))))
(when (memq class '(quanpin))
(let ((rest (mapconcat
- #'(lambda (py)
- (concat (nth 0 py) (nth 1 py)))
+ (lambda (py)
+ (concat (nth 0 py) (nth 1 py)))
(nthcdr (length preview) (car pyim-imobjs))
"'")))
(when (string< "" rest)
diff --git a/pyim-probe.el b/pyim-probe.el
index 9b331e9..e716574 100644
--- a/pyim-probe.el
+++ b/pyim-probe.el
@@ -92,8 +92,8 @@
;; isearch 启动的时候,会设置一个 buffer variable: `isearch-mode'
;; 检测所有 buffer 中 `isearch-mode' 的取值,如果任何一个
;; 取值为 t, 就说明 isearch 已经启动。
- (cl-some #'(lambda (buf)
- (buffer-local-value 'isearch-mode buf))
+ (cl-some (lambda (buf)
+ (buffer-local-value 'isearch-mode buf))
(buffer-list))))
(defun pyim-probe-org-structure-template ()
diff --git a/pyim.el b/pyim.el
index a10f3ac..f895843 100644
--- a/pyim.el
+++ b/pyim.el
@@ -573,10 +573,10 @@ Return the input string.
"判断是否 *根据环境自动切换* 为英文输入模式,这个函数处理变量:
`pyim-english-input-switch-functions'"
(let* ((func-or-list pyim-english-input-switch-functions))
- (and (cl-some #'(lambda (x)
- (if (functionp x)
- (funcall x)
- nil))
+ (and (cl-some (lambda (x)
+ (if (functionp x)
+ (funcall x)
+ nil))
(cond ((functionp func-or-list) (list func-or-list))
((listp func-or-list) func-or-list)
(t nil)))
@@ -699,8 +699,8 @@ Return the input string.
;; to-be-translated.
(to-be-translated (mapconcat #'identity
(mapcar
- #'(lambda (w)
- (concat (nth 2 w) (nth 3 w)))
+ (lambda (w)
+ (concat (nth 2 w) (nth 3 w)))
(nthcdr length-selected-word imobj))
"")))
;; 大体来说,entered 字符串可以分解为三个部分:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/pyim 88307d3: Remove # before the lambda.,
ELPA Syncer <=