[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xr b07de9bc2c 05/18: Faster joining of chars to strings
From: |
ELPA Syncer |
Subject: |
[elpa] externals/xr b07de9bc2c 05/18: Faster joining of chars to strings |
Date: |
Thu, 1 Aug 2024 13:00:00 -0400 (EDT) |
branch: externals/xr
commit b07de9bc2cc5c33e782b6c3d743eaf42ed71e570
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>
Faster joining of chars to strings
---
xr.el | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/xr.el b/xr.el
index e1843a941f..5996c40839 100644
--- a/xr.el
+++ b/xr.el
@@ -277,19 +277,34 @@
(defun xr--rev-join-seq (sequence)
"Reverse SEQUENCE, flatten any (seq ...) inside, and concatenate
adjacent strings. SEQUENCE is used destructively."
- (let ((result nil))
+ (let ((strings nil)
+ (result nil))
(while sequence
(let ((elem (car sequence))
(rest (cdr sequence)))
- (cond ((and (consp elem) (eq (car elem) 'seq))
- (setq sequence (nconc (nreverse (cdr elem)) rest)))
- ((and (stringp elem) (stringp (car result)))
- (setq result (cons (concat elem (car result)) (cdr result)))
- (setq sequence rest))
- (t
- (setq result (cons elem result))
- (setq sequence rest)))))
- result))
+ (setq sequence
+ (cond ((stringp elem)
+ (push elem strings)
+ rest)
+ ((eq (car-safe elem) 'seq)
+ (nconc (nreverse (cdr elem)) rest))
+ (strings
+ (push (if (cdr strings)
+ (mapconcat #'identity strings nil)
+ (car strings))
+ result)
+ (setq strings nil)
+ (push elem result)
+ rest)
+ (t
+ (push elem result)
+ rest)))))
+ (if strings
+ (cons (if (cdr strings)
+ (mapconcat #'identity strings nil)
+ (car strings))
+ result)
+ result)))
(defun xr--char-category (negated category-code)
(let* ((sym (assq category-code
- [elpa] externals/xr updated (71c748ed7c -> c5da86864b), ELPA Syncer, 2024/08/01
- [elpa] externals/xr 6f42ebafef 02/18: Copyright year update, ELPA Syncer, 2024/08/01
- [elpa] externals/xr d81c7e05a0 07/18: Parse the regexp string directly instead of creating a temp buffer, ELPA Syncer, 2024/08/01
- [elpa] externals/xr a3d8350cf7 09/18: Include parse errors in the diagnostics when linting, ELPA Syncer, 2024/08/01
- [elpa] externals/xr b07de9bc2c 05/18: Faster joining of chars to strings,
ELPA Syncer <=
- [elpa] externals/xr 90cd77a251 11/18: Use ranges in warnings, ELPA Syncer, 2024/08/01
- [elpa] externals/xr f81b5de888 12/18: Extract diagnostics sorting to a function, ELPA Syncer, 2024/08/01
- [elpa] externals/xr 345b626abf 17/18: NEWS entry for upcoming version 2.0, ELPA Syncer, 2024/08/01
- [elpa] externals/xr ab11e4229d 03/18: Move version history to separate NEWS file, ELPA Syncer, 2024/08/01
- [elpa] externals/xr cbb39a2f52 06/18: Performance hack: speed up xr--superset-p for strings, ELPA Syncer, 2024/08/01
- [elpa] externals/xr 548990e952 04/18: Simplify: make second arg to xr--escape-string optional, ELPA Syncer, 2024/08/01
- [elpa] externals/xr ee9870ea83 08/18: Signal new `xr-parse-error` for parsing errors, ELPA Syncer, 2024/08/01
- [elpa] externals/xr a003438b44 01/18: Check xr-lint `purpose` argument for validity., ELPA Syncer, 2024/08/01
- [elpa] externals/xr 14b639fc1e 10/18: Diagnostics now carry a range, not a single string offset, ELPA Syncer, 2024/08/01
- [elpa] externals/xr 6a708ef75a 14/18: Group diagnostics that belong together, ELPA Syncer, 2024/08/01