um-tag-insert should refuse to add dupes

This commit is contained in:
bth 2026-06-05 13:46:15 -07:00
commit ec96a2a436

9
um.el
View file

@ -294,10 +294,15 @@ Ultimately this relies on `xref-matches-in-files', which calls
(reverse tags)))
(defun um-tag-insert (tag)
"Insert TAG as + tag\n in current buffer appending to the journal header."
"Insert TAG as + tag\n in current buffer appending to the journal header.
Emits message if TAG is already present, but does not error."
(if (member tag (um--extract-tags (list buffer-file-name)))
;; NOTE: user-error would stop any iteration over files:
(message "\"%s\" tag already exists in %s" tag buffer-file-name)
(goto-char (um--header-end-pos))
(forward-line -1)
(insert (concat "+ " tag "\n")))
(insert (concat "+ " tag "\n"))))
(defun um-tag-delete (tag)
"Delete TAG from the journal header in current buffer."