1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00

Avoid problems when one tag/file is a substring of another

* lisp/image-dired.el (image-dired-remove-tag): End of filename is bound
by ";" and end of tag is bound by ";" or end of line.
This commit is contained in:
Peter Münster 2021-08-18 02:02:02 +02:00 committed by Lars Ingebrigtsen
parent 101b3c81b6
commit 63d6e1ffa1

View File

@ -1111,11 +1111,12 @@ FILE-TAGS is an alist in the following form:
(error "Files must be a string or a list of strings!")))
(dolist (file files)
(goto-char (point-min))
(when (search-forward-regexp (format "^%s" file) nil t)
(when (search-forward-regexp (format "^%s;" file) nil t)
(end-of-line)
(setq end (point))
(beginning-of-line)
(when (search-forward-regexp (format "\\(;%s\\)" tag) end t)
(when (search-forward-regexp
(format "\\(;%s\\)\\($\\|;\\)" tag) end t)
(delete-region (match-beginning 1) (match-end 1))
;; Check if file should still be in the database. If
;; it has no tags or comments, it will be removed.