Fix checksum of mobileorg.org after moving content

This commit is contained in:
Carsten Dominik 2009-10-19 13:20:51 +02:00
parent 03ecf8d91f
commit d1b756f381
1 changed files with 17 additions and 2 deletions

View File

@ -132,7 +132,7 @@ For now, it is not recommended to change this variable."
(executable-find "sha1sum")
(executable-find "md5sum")
(executable-find "md5"))
"Executable used for computing checksums of aenda files."
"Executable used for computing checksums of agenda files."
:group 'org-mobile
:type 'string)
@ -534,10 +534,25 @@ If nothing new has beed added, return nil."
(save-buffer)
(set-buffer capture-buffer)
(erase-buffer)
(save-buffer)))
(save-buffer)
(org-mobile-update-checksum-for-capture-file (buffer-string))))
(kill-buffer capture-buffer)
(if not-empty insertion-point)))
(defun org-mobile-update-checksum-for-capture-file (buffer-string)
(let* ((file (expand-file-name "checksums.dat" org-mobile-directory))
(buffer (find-file-noselect file)))
(when buffer
(with-current-buffer buffer
(when (re-search-forward (concat "\\([0-9a-fA-F]\\{30,\\}\\).*?"
(regexp-quote org-mobile-capture-file)
"[ \t]*$"))
(goto-char (match-beginning 1))
(delete-region (match-beginning 1) (match-end 1))
(insert (md5 buffer-string))
(save-buffer)))
(kill-buffer buffer))))
(defun org-mobile-apply (&optional beg end)
"Apply all change requests in the current buffer.
If BEG and END are given, only do this in that region."