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
commit30660b162860f742a0ade2dc9dc017226eb7289f (patch)
treee159551b193aadde42a4ca188fcd0691a3d01d7f
parentd78a9fc8069a3ac2198f9b2d2f69386cc5873e60 (diff)
downloadtxr-30660b162860f742a0ade2dc9dc017226eb7289f.tar.gz
txr-30660b162860f742a0ade2dc9dc017226eb7289f.tar.bz2
txr-30660b162860f742a0ade2dc9dc017226eb7289f.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)))