summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-03-05 23:12:14 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-03-05 23:12:14 -0800
commit35942b81d12cb587d10a8cbf82d20e2b93bc48f7 (patch)
treee159551b193aadde42a4ca188fcd0691a3d01d7f
parent45807db4c6f8524b770ff0ae8581400b6e140c53 (diff)
downloadtxr-35942b81d12cb587d10a8cbf82d20e2b93bc48f7.tar.gz
txr-35942b81d12cb587d10a8cbf82d20e2b93bc48f7.tar.bz2
txr-35942b81d12cb587d10a8cbf82d20e2b93bc48f7.zip
tags: implement merge with merge function.
* tags.tl (write-tagfile): Since we can assume that the tags file is sorted, and the tags coming into this function are likewise sorted, we can just merge the sorted lists. Then, we don't have to sort the tags list a second time.
-rwxr-xr-xtags.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/tags.tl b/tags.tl
index bb32ee44..3d6be813 100755
--- a/tags.tl
+++ b/tags.tl
@@ -135,10 +135,10 @@
(orig-tags (collect-each ((line lines))
(new orig-tag ident (m^ #/[^\t]*/ line)
line line))))
- (set tags (append tags orig-tags)))
+ (set tags (merge tags orig-tags : .ident)))
(path-not-found (e))))
(with-stream (stream (open-file "tags" (if o.append "a" "w")))
- (each ((tag (sort tags : .ident)))
+ (each ((tag tags))
(put-line tag.(text) stream))))
(let ((o (new tags-opts)))