diff options
| author | Mathias Dahl | 2006-07-24 16:22:44 +0000 |
|---|---|---|
| committer | Mathias Dahl | 2006-07-24 16:22:44 +0000 |
| commit | dca90550b93437560a6c989ab3c2bed0a7333fd4 (patch) | |
| tree | 1a408ddb59b057cef38e86e79decd3c418ca2b19 | |
| parent | 3098323a4ddd061862fcd8c5aefc8bdb8c4b67d5 (diff) | |
| download | emacs-dca90550b93437560a6c989ab3c2bed0a7333fd4.tar.gz emacs-dca90550b93437560a6c989ab3c2bed0a7333fd4.zip | |
(tumme-write-tags): Add.
(tumme-write-comments): Add.
(tumme-tag-files): Change to use `tumme-write-tags'.
(tumme-tag-thumbnail): Change to use `tumme-write-tags'.
(tumme-dired-comment-files): Change to use `tumme-write-comments'.
(tumme-save-information-from-widgets): Change to use
`tumme-write-comments' and `tumme-write-tags'.
(tumme-comment-thumbnail): Change to use `tumme-write-comments'.
(tumme-write-tag): Remove.
(tumme-write-comment): Remove.
(tumme-display-previous-thumbnail-original): Remove empty line.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/tumme.el | 62 |
2 files changed, 3 insertions, 62 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed3f0ea4829..2a957b289d2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -8,6 +8,9 @@ | |||
| 8 | (tumme-save-information-from-widgets): Change to use | 8 | (tumme-save-information-from-widgets): Change to use |
| 9 | `tumme-write-comments' and `tumme-write-tags'. | 9 | `tumme-write-comments' and `tumme-write-tags'. |
| 10 | (tumme-comment-thumbnail): Change to use `tumme-write-comments'. | 10 | (tumme-comment-thumbnail): Change to use `tumme-write-comments'. |
| 11 | (tumme-write-tag): Remove. | ||
| 12 | (tumme-write-comment): Remove. | ||
| 13 | (tumme-display-previous-thumbnail-original): Remove empty line. | ||
| 11 | 14 | ||
| 12 | 2006-07-24 mathias <mathias.dahl@gmail.com> | 15 | 2006-07-24 mathias <mathias.dahl@gmail.com> |
| 13 | 16 | ||
diff --git a/lisp/tumme.el b/lisp/tumme.el index 667d466e0a5..d7fae222aa2 100644 --- a/lisp/tumme.el +++ b/lisp/tumme.el | |||
| @@ -868,33 +868,6 @@ displayed." | |||
| 868 | ;;;###autoload | 868 | ;;;###autoload |
| 869 | (defalias 'tumme 'tumme-show-all-from-dir) | 869 | (defalias 'tumme 'tumme-show-all-from-dir) |
| 870 | 870 | ||
| 871 | (defun tumme-write-tag (files tag) | ||
| 872 | "For all FILES, writes TAG to the image database." | ||
| 873 | (save-excursion | ||
| 874 | (let (end buf) | ||
| 875 | (setq buf (find-file tumme-db-file)) | ||
| 876 | (if (not (listp files)) | ||
| 877 | (if (stringp files) | ||
| 878 | (setq files (list files)) | ||
| 879 | (error "Files must be a string or a list of strings!"))) | ||
| 880 | (mapcar | ||
| 881 | (lambda (file) | ||
| 882 | (goto-char (point-min)) | ||
| 883 | (if (search-forward-regexp | ||
| 884 | (format "^%s" file) nil t) | ||
| 885 | (progn | ||
| 886 | (end-of-line) | ||
| 887 | (setq end (point)) | ||
| 888 | (beginning-of-line) | ||
| 889 | (when (not (search-forward (format ";%s" tag) end t)) | ||
| 890 | (end-of-line) | ||
| 891 | (insert (format ";%s" tag)))) | ||
| 892 | (goto-char (point-max)) | ||
| 893 | (insert (format "\n%s;%s" file tag)))) | ||
| 894 | files) | ||
| 895 | (save-buffer) | ||
| 896 | (kill-buffer buf)))) | ||
| 897 | |||
| 898 | (defun tumme-write-tags (file-tags) | 871 | (defun tumme-write-tags (file-tags) |
| 899 | "Write file tags to database. | 872 | "Write file tags to database. |
| 900 | Write each file and tag in FILE-TAGS to the database. FILE-TAGS | 873 | Write each file and tag in FILE-TAGS to the database. FILE-TAGS |
| @@ -2039,45 +2012,10 @@ function. The result is a couple of new files in | |||
| 2039 | 2012 | ||
| 2040 | (defun tumme-display-previous-thumbnail-original () | 2013 | (defun tumme-display-previous-thumbnail-original () |
| 2041 | "Move to previous thumbnail and display image." | 2014 | "Move to previous thumbnail and display image." |
| 2042 | |||
| 2043 | (interactive) | 2015 | (interactive) |
| 2044 | (tumme-backward-char) | 2016 | (tumme-backward-char) |
| 2045 | (tumme-display-thumbnail-original-image)) | 2017 | (tumme-display-thumbnail-original-image)) |
| 2046 | 2018 | ||
| 2047 | (defun tumme-write-comment (file comment) | ||
| 2048 | "For FILE, write comment COMMENT in database." | ||
| 2049 | (save-excursion | ||
| 2050 | (let (end buf comment-beg) | ||
| 2051 | (setq buf (find-file tumme-db-file)) | ||
| 2052 | (goto-char (point-min)) | ||
| 2053 | (if (search-forward-regexp | ||
| 2054 | (format "^%s" file) nil t) | ||
| 2055 | (progn | ||
| 2056 | (end-of-line) | ||
| 2057 | (setq end (point)) | ||
| 2058 | (beginning-of-line) | ||
| 2059 | ;; Delete old comment, if any | ||
| 2060 | (cond ((search-forward ";comment:" end t) | ||
| 2061 | (setq comment-beg (match-beginning 0)) | ||
| 2062 | ;; Any tags after the comment? | ||
| 2063 | (if (search-forward ";" end t) | ||
| 2064 | (setq comment-end (- (point) 1)) | ||
| 2065 | (setq comment-end end)) | ||
| 2066 | ;; Delete comment tag and comment | ||
| 2067 | (delete-region comment-beg comment-end))) | ||
| 2068 | ;; Insert new comment | ||
| 2069 | (beginning-of-line) | ||
| 2070 | (if (not (search-forward ";" end t)) | ||
| 2071 | (progn | ||
| 2072 | (end-of-line) | ||
| 2073 | (insert ";"))) | ||
| 2074 | (insert (format "comment:%s;" comment))) | ||
| 2075 | ;; File does not exist in databse - add it. | ||
| 2076 | (goto-char (point-max)) | ||
| 2077 | (insert (format "\n%s;comment:%s" file comment))) | ||
| 2078 | (save-buffer) | ||
| 2079 | (kill-buffer buf)))) | ||
| 2080 | |||
| 2081 | (defun tumme-write-comments (file-comments) | 2019 | (defun tumme-write-comments (file-comments) |
| 2082 | "Write file comments to database. | 2020 | "Write file comments to database. |
| 2083 | Write file comments to one or more files. FILE-COMMENTS is an alist on | 2021 | Write file comments to one or more files. FILE-COMMENTS is an alist on |