um-tag-delete warns about tag not found

This commit is contained in:
bth 2026-06-05 13:50:19 -07:00
commit 61dee27223

7
um.el
View file

@ -307,8 +307,11 @@ Emits message if TAG is already present, but does not error."
(defun um-tag-delete (tag) (defun um-tag-delete (tag)
"Delete TAG from the journal header in current buffer." "Delete TAG from the journal header in current buffer."
(goto-char (point-min)) (goto-char (point-min))
(when (search-forward (concat "+ " tag "\n") (um--header-end-pos) t) (if (search-forward (concat "+ " tag "\n") (um--header-end-pos) t)
(delete-region (match-beginning 0) (match-end 0)))) (delete-region (match-beginning 0) (match-end 0))
;; NOTE: as long as collection was gathered with um--extract-tags, this
;; shouldn't happen:
(message "\"%s\" tag not found in %s" tag buffer-file-name)))
(defun um-tag-do (tag insert) (defun um-tag-do (tag insert)
"Insert or delete TAG from the journal header in current buffer. "Insert or delete TAG from the journal header in current buffer.