comparison lisp/tumme.el @ 68811:268f839373ee

Some small fixes.
author Mathias Dahl <mathias.dahl@gmail.com>
date Sat, 11 Feb 2006 23:31:23 +0000
parents 3e96b0954fa1
children 3e8cc27a9bcf
comparison
equal deleted inserted replaced
68810:0e986f2bd386 68811:268f839373ee
2306 (tumme-display-thumbnail-original-image)) 2306 (tumme-display-thumbnail-original-image))
2307 2307
2308 (defun tumme-write-comment (file comment) 2308 (defun tumme-write-comment (file comment)
2309 "For FILE, write comment COMMENT in database." 2309 "For FILE, write comment COMMENT in database."
2310 (save-excursion 2310 (save-excursion
2311 (let (end buf comment-beg 2311 (let (end buf comment-beg)
2312 (base-name (file-name-nondirectory file)))
2313 (setq buf (find-file tumme-db-file)) 2312 (setq buf (find-file tumme-db-file))
2314 (goto-char (point-min)) 2313 (goto-char (point-min))
2315 (if (search-forward-regexp 2314 (if (search-forward-regexp
2316 (format "^%s" base-name) nil t) 2315 (format "^%s" file) nil t)
2317 (progn 2316 (progn
2318 (end-of-line) 2317 (end-of-line)
2319 (setq end (point)) 2318 (setq end (point))
2320 (beginning-of-line) 2319 (beginning-of-line)
2321 ;; Delete old comment, if any 2320 ;; Delete old comment, if any
2334 (end-of-line) 2333 (end-of-line)
2335 (insert ";"))) 2334 (insert ";")))
2336 (insert (format "comment:%s;" comment))) 2335 (insert (format "comment:%s;" comment)))
2337 ;; File does not exist in databse - add it. 2336 ;; File does not exist in databse - add it.
2338 (goto-char (point-max)) 2337 (goto-char (point-max))
2339 (insert (format "\n%s;comment:%s" base-name comment))) 2338 (insert (format "\n%s;comment:%s" file comment)))
2340 (save-buffer) 2339 (save-buffer)
2341 (kill-buffer buf)))) 2340 (kill-buffer buf))))
2342 2341
2343 (defun tumme-update-property (prop value) 2342 (defun tumme-update-property (prop value)
2344 "Update text property PROP with value VALUE at point." 2343 "Update text property PROP with value VALUE at point."
2415 (save-excursion 2414 (save-excursion
2416 (setq buf (find-file tumme-db-file)) 2415 (setq buf (find-file tumme-db-file))
2417 (goto-char (point-min)) 2416 (goto-char (point-min))
2418 ;; Collect matches 2417 ;; Collect matches
2419 (while (search-forward-regexp 2418 (while (search-forward-regexp
2420 (concat "\\(^[^;]+\\);.*" tag ".*$") nil t) 2419 (concat "\\(^[^;\n]+\\);.*" tag ".*$") nil t)
2421 (setq files (append (list (match-string 1)) files))) 2420 (setq files (append (list (match-string 1)) files)))
2422 (kill-buffer buf) 2421 (kill-buffer buf)
2423 ;; Mark files 2422 ;; Mark files
2424 (mapcar 2423 (mapcar
2425 ;; I tried using `dired-mark-files-regexp' but it was 2424 ;; I tried using `dired-mark-files-regexp' but it was