Function: image-dired-write-tags

image-dired-write-tags is a byte-compiled function defined in image-dired-tags.el.gz.

Signature

(image-dired-write-tags FILE-TAGS)

Documentation

Write file tags to database.

Write each file and tag in FILE-TAGS to the database. FILE-TAGS is an alist in the following form:
 ((FILE . TAG) ... )

Source Code

;; Defined in /usr/src/emacs/lisp/image/image-dired-tags.el.gz
(defun image-dired-write-tags (file-tags)
  "Write file tags to database.
Write each file and tag in FILE-TAGS to the database.
FILE-TAGS is an alist in the following form:
 ((FILE . TAG) ... )"
  (image-dired-sane-db-file)
  (let (end file tag)
    (image-dired--with-db-file
      (setq buffer-file-name image-dired-tags-db-file)
      (dolist (elt file-tags)
        (setq file (car elt)
              tag (cdr elt))
        (goto-char (point-min))
        (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) nil t)
            (progn
              (setq end (point))
              (beginning-of-line)
              (when (not (search-forward (format ";%s" tag) end t))
                (end-of-line)
                (insert (format ";%s" tag))))
          (goto-char (point-max))
          (insert (format "%s;%s\n" file tag))))
      (save-buffer))))