Function: image-dired-remove-tag
image-dired-remove-tag is a byte-compiled function defined in
image-dired-tags.el.gz.
Signature
(image-dired-remove-tag FILES TAG)
Documentation
For each file in FILES, remove TAG from the image database.
FILES can be a name of a single file (a string) or a list of file names.
Source Code
;; Defined in /usr/src/emacs/lisp/image/image-dired-tags.el.gz
(defun image-dired-remove-tag (files tag)
"For each file in FILES, remove TAG from the image database.
FILES can be a name of a single file (a string) or a list of file names."
(image-dired-sane-db-file)
(image-dired--with-db-file
(setq buffer-file-name image-dired-tags-db-file)
(let (end)
(unless (listp files)
(if (stringp files)
(setq files (list files))
(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)
(end-of-line)
(setq end (point))
(beginning-of-line)
(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.
(end-of-line)
(setq end (point))
(beginning-of-line)
(when (not (search-forward ";" end t))
(kill-line 1))))))
(save-buffer)))