Mercurial > emacs
comparison lisp/tumme.el @ 72087:585ed6ff296a
(tumme-write-tags): Add.
(tumme-write-comments): Add.
author | Mathias Dahl <mathias.dahl@gmail.com> |
---|---|
date | Mon, 24 Jul 2006 16:10:46 +0000 |
parents | eeafd2670b7f |
children | d2f7e6fe7dbf |
comparison
equal
deleted
inserted
replaced
72086:2d3129f3f8a0 | 72087:585ed6ff296a |
---|---|
2071 ;; File does not exist in databse - add it. | 2071 ;; File does not exist in databse - add it. |
2072 (goto-char (point-max)) | 2072 (goto-char (point-max)) |
2073 (insert (format "\n%s;comment:%s" file comment))) | 2073 (insert (format "\n%s;comment:%s" file comment))) |
2074 (save-buffer) | 2074 (save-buffer) |
2075 (kill-buffer buf)))) | 2075 (kill-buffer buf)))) |
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))))))) | |
2076 | 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)) |
2080 (put-text-property | 2115 (put-text-property |