diff options
| author | Mathias Dahl | 2006-07-24 16:11:01 +0000 |
|---|---|---|
| committer | Mathias Dahl | 2006-07-24 16:11:01 +0000 |
| commit | 231b0d1cd9e088ab0192f712b91651a1a894197f (patch) | |
| tree | b8420e7631ab7707bccc97623c3faee76c777f84 | |
| parent | cf882898244e313f06732005d9d59f552a4f9ae8 (diff) | |
| download | emacs-231b0d1cd9e088ab0192f712b91651a1a894197f.tar.gz emacs-231b0d1cd9e088ab0192f712b91651a1a894197f.zip | |
(tumme-write-tags): Add.
(tumme-write-comments): Add.
| -rw-r--r-- | lisp/ChangeLog | 1 | ||||
| -rw-r--r-- | lisp/tumme.el | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83f286d3704..5375b041930 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | 2006-07-24 mathias <mathias@mattis> | 1 | 2006-07-24 mathias <mathias@mattis> |
| 2 | 2 | ||
| 3 | * tumme.el (tumme-write-tags): Add. | 3 | * tumme.el (tumme-write-tags): Add. |
| 4 | (tumme-write-comments): Add. | ||
| 4 | 5 | ||
| 5 | 2006-07-24 mathias <mathias.dahl@gmail.com> | 6 | 2006-07-24 mathias <mathias.dahl@gmail.com> |
| 6 | 7 | ||
diff --git a/lisp/tumme.el b/lisp/tumme.el index 134420ddc91..7e3d83173a1 100644 --- a/lisp/tumme.el +++ b/lisp/tumme.el | |||
| @@ -2074,6 +2074,41 @@ function. The result is a couple of new files in | |||
| 2074 | (save-buffer) | 2074 | (save-buffer) |
| 2075 | (kill-buffer buf)))) | 2075 | (kill-buffer buf)))) |
| 2076 | 2076 | ||
| 2077 | (defun tumme-write-comments (file-comments) | ||
| 2078 | "Write file comments to database. | ||
| 2079 | Write file comments to one or more files. FILE-COMMENTS is an alist on | ||
| 2080 | the following form: | ||
| 2081 | ((FILE . COMMENT) ... )" | ||
| 2082 | (let (end comment-beg file comment) | ||
| 2083 | (with-temp-file tumme-db-file | ||
| 2084 | (insert-file-contents tumme-db-file) | ||
| 2085 | (dolist (elt file-comments) | ||
| 2086 | (setq file (car elt) | ||
| 2087 | comment (cdr elt)) | ||
| 2088 | (goto-char (point-min)) | ||
| 2089 | (if (search-forward-regexp (format "^%s.*$" file) nil t) | ||
| 2090 | (progn | ||
| 2091 | (setq end (point)) | ||
| 2092 | (beginning-of-line) | ||
| 2093 | ;; Delete old comment, if any | ||
| 2094 | (when (search-forward ";comment:" end t) | ||
| 2095 | (setq comment-beg (match-beginning 0)) | ||
| 2096 | ;; Any tags after the comment? | ||
| 2097 | (if (search-forward ";" end t) | ||
| 2098 | (setq comment-end (- (point) 1)) | ||
| 2099 | (setq comment-end end)) | ||
| 2100 | ;; Delete comment tag and comment | ||
| 2101 | (delete-region comment-beg comment-end)) | ||
| 2102 | ;; Insert new comment | ||
| 2103 | (beginning-of-line) | ||
| 2104 | (unless (search-forward ";" end t) | ||
| 2105 | (end-of-line) | ||
| 2106 | (insert ";")) | ||
| 2107 | (insert (format "comment:%s;" comment))) | ||
| 2108 | ;; File does not exist in database - add it. | ||
| 2109 | (goto-char (point-max)) | ||
| 2110 | (insert (format "\n%s;comment:%s" file comment))))))) | ||
| 2111 | |||
| 2077 | (defun tumme-update-property (prop value) | 2112 | (defun tumme-update-property (prop value) |
| 2078 | "Update text property PROP with value VALUE at point." | 2113 | "Update text property PROP with value VALUE at point." |
| 2079 | (let ((inhibit-read-only t)) | 2114 | (let ((inhibit-read-only t)) |