emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/tumme.el,v


From: Mathias Dahl
Subject: [Emacs-diffs] Changes to emacs/lisp/tumme.el,v
Date: Mon, 24 Jul 2006 16:09:17 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Mathias Dahl <mathiasdahl>      06/07/24 16:09:17

Index: tumme.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tumme.el,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- tumme.el    24 Jul 2006 09:40:09 -0000      1.34
+++ tumme.el    24 Jul 2006 16:09:17 -0000      1.35
@@ -895,6 +895,28 @@
       (save-buffer)
       (kill-buffer buf))))
 
+(defun tumme-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) ... )"
+  (let (end file tag)
+    (with-temp-file tumme-db-file
+      (insert-file-contents tumme-db-file)
+      (dolist (elt file-tags)
+       (setq file (car elt)
+             tag (cdr elt))
+       (goto-char (point-min))
+       (if (search-forward-regexp (format "^%s.*$" 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 "\n%s;%s" file tag)))))))
+
 (defun tumme-remove-tag (files tag)
   "For all FILES, remove TAG from the image database."
   (save-excursion




reply via email to

[Prev in Thread] Current Thread [Next in Thread]