Seems ekg-remove-unused-tags doesn't remove trashed tags completely (see sceenshot).
(ekg-tags) inside ekg-remove-unused-tags doesn't cover these trashed tags, since it contains a predicate (and (not (ekg-tag-trash-p tag)) (not (equal tag ekg-draft-tag))).
It should be replaced with (triples-subjects-of-type ekg-db 'tag), so that all tags are retrieved for ekg-tag-used-p to filter.
Thus:
Before:
(defun ekg-remove-unused-tags ()
"Remove all tags that are not used and have no info."
(cl-loop for tag in (seq-filter (lambda (tag) (not (ekg-tag-used-p tag))) (ekg-tags))
do
(ekg-tag-delete tag)))
After:
(defun ekg-remove-unused-tags ()
"Remove all tags that are not used and have no info."
(ekg-connect)
(cl-loop for tag in (seq-filter
(lambda (tag) (not (ekg-tag-used-p tag)))
(triples-subjects-of-type ekg-db 'tag))
do
(ekg-tag-delete tag)))
Screenshot: remaining trashed tags right after a fresh ekg-clean-db.
Hi @ahyatt ,
Seems
ekg-remove-unused-tags
doesn't remove trashed tags completely (see sceenshot).(ekg-tags)
insideekg-remove-unused-tags
doesn't cover these trashed tags, since it contains a predicate(and (not (ekg-tag-trash-p tag)) (not (equal tag ekg-draft-tag)))
.It should be replaced with
(triples-subjects-of-type ekg-db 'tag)
, so that all tags are retrieved forekg-tag-used-p
to filter.Thus:
Before:
After:
Screenshot: remaining trashed tags right after a fresh
ekg-clean-db
.