Function: image-dired-remove-tag

image-dired-remove-tag is a byte-compiled function defined in image-dired.el.gz.

Signature

(image-dired-remove-tag FILES TAG)

Documentation

For all FILES, remove TAG from the image database.

Source Code

;; Defined in /usr/src/emacs/lisp/image-dired.el.gz
(defun image-dired-remove-tag (files tag)
  "For all FILES, remove TAG from the image database."
  (image-dired-sane-db-file)
  (image-dired--with-db-file
   (setq buffer-file-name image-dired-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)))