comparison lisp/tumme.el @ 72085:eeafd2670b7f

(tumme-write-tags): Add.
author Mathias Dahl <mathias.dahl@gmail.com>
date Mon, 24 Jul 2006 16:09:17 +0000
parents bb51418c995c
children 585ed6ff296a
comparison
equal deleted inserted replaced
72084:002ee31c5102 72085:eeafd2670b7f
892 (goto-char (point-max)) 892 (goto-char (point-max))
893 (insert (format "\n%s;%s" file tag)))) 893 (insert (format "\n%s;%s" file tag))))
894 files) 894 files)
895 (save-buffer) 895 (save-buffer)
896 (kill-buffer buf)))) 896 (kill-buffer buf))))
897
898 (defun tumme-write-tags (file-tags)
899 "Write file tags to database.
900 Write each file and tag in FILE-TAGS to the database. FILE-TAGS
901 is an alist in the following form:
902 ((FILE . TAG) ... )"
903 (let (end file tag)
904 (with-temp-file tumme-db-file
905 (insert-file-contents tumme-db-file)
906 (dolist (elt file-tags)
907 (setq file (car elt)
908 tag (cdr elt))
909 (goto-char (point-min))
910 (if (search-forward-regexp (format "^%s.*$" file) nil t)
911 (progn
912 (setq end (point))
913 (beginning-of-line)
914 (when (not (search-forward (format ";%s" tag) end t))
915 (end-of-line)
916 (insert (format ";%s" tag))))
917 (goto-char (point-max))
918 (insert (format "\n%s;%s" file tag)))))))
897 919
898 (defun tumme-remove-tag (files tag) 920 (defun tumme-remove-tag (files tag)
899 "For all FILES, remove TAG from the image database." 921 "For all FILES, remove TAG from the image database."
900 (save-excursion 922 (save-excursion
901 (let (end buf start) 923 (let (end buf start)