[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 976f7f4 5/5: 添加 pyim-flatten-tree, 旧版本的 Emacs 没有
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 976f7f4 5/5: 添加 pyim-flatten-tree, 旧版本的 Emacs 没有 flatten-tree. |
Date: |
Wed, 8 Dec 2021 00:57:31 -0500 (EST) |
branch: externals/pyim
commit 976f7f41911dc5a8a4a60950c75cdd483d1263e4
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
添加 pyim-flatten-tree, 旧版本的 Emacs 没有 flatten-tree.
---
pyim-common.el | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/pyim-common.el b/pyim-common.el
index f6af740..5158da3 100644
--- a/pyim-common.el
+++ b/pyim-common.el
@@ -102,10 +102,24 @@ When CARE-FIRST-ONE is no-nil, ((a b c) (d e)) => (a d)."
(append x (make-list (- n (length x)) nil)))
lists)))
(delete-dups
- (flatten-tree
+ (pyim-flatten-tree
(apply #'cl-mapcar
#'list lists))))))
+(if (fboundp 'flatten-tree)
+ (defalias 'pyim-flatten-tree 'flatten-tree)
+ (defun pyim-flatten-tree (tree)
+ "Take TREE and \"flatten\" it."
+ (let (elems)
+ (while (consp tree)
+ (let ((elem (pop tree)))
+ (while (consp elem)
+ (push (cdr elem) tree)
+ (setq elem (car elem)))
+ (if elem (push elem elems))))
+ (if tree (push tree elems))
+ (nreverse elems))))
+
(defun pyim-subconcat (list &optional sep)
"Concat sublist of LIST with SEP: (a b c d) => (abcd abc ab)."
(let ((n (length list))
- [elpa] externals/pyim updated (6f23551 -> 976f7f4), ELPA Syncer, 2021/12/08
- [elpa] externals/pyim 46f03c9 3/5: Add tests, ELPA Syncer, 2021/12/08
- [elpa] externals/pyim 976f7f4 5/5: 添加 pyim-flatten-tree, 旧版本的 Emacs 没有 flatten-tree.,
ELPA Syncer <=
- [elpa] externals/pyim 41b5eb2 1/5: * pyim-cstring.el (pyim-cstring-split-to-string-1): 修复插入分割符位置不对的问题。, ELPA Syncer, 2021/12/08
- [elpa] externals/pyim 03253ba 2/5: * pyim-cstring.el (pyim-cstring-split-to-string): 稍微优化。, ELPA Syncer, 2021/12/08
- [elpa] externals/pyim 50c4793 4/5: Fix test, ELPA Syncer, 2021/12/08