Fix a number of issues with MobileOrg encryption.

* lisp/org-mobile.el (org-mobile-create-index-file): Encrypt the index file
if encryption has been turned on.
(org-mobile-copy-agenda-files): Avoid double encryption of `mobileorg.org'.
* doc/org.texi (Setting up the staging area): Document that file names remain
visible when encrypting the MobileOrg files.
This commit is contained in:
Carsten Dominik 2010-10-13 10:48:35 +02:00
parent 5014288b68
commit 9755e09bbc
2 changed files with 20 additions and 9 deletions

View File

@ -14261,7 +14261,9 @@ MobileOrg 1.5. On the Emacs side, configure the variable
@code{org-mobile-use-encryption}. If you can safely store the password in
your Emacs setup, you might also want to configure
@code{org-mobile-encryption-password}. Please read the docstring of that
variable.}. The easiest way to create that directory is to use a free
variable. Note that encryption will apply only to the contents of the
@file{.org} files. The file names themselves will remain visible.}. The
easiest way to create that directory is to use a free
@uref{http://dropbox.com,Dropbox.com} account@footnote{If you cannot use
Dropbox, or if your version of MobileOrg does not support it, you can use a
webdav server. For more information, check out the the documentation of

View File

@ -388,6 +388,8 @@ agenda view showing the flagged items."
(lambda (a b) (string< (cdr a) (cdr b)))))
(def-todo (default-value 'org-todo-keywords))
(def-tags (default-value 'org-tag-alist))
(target-file (expand-file-name org-mobile-index-file
org-mobile-directory))
file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
(org-prepare-agenda-buffers (mapcar 'car files-alist))
@ -406,7 +408,9 @@ agenda view showing the flagged items."
(t nil)))
org-tag-alist-for-agenda))))
(with-temp-file
(expand-file-name org-mobile-index-file org-mobile-directory)
(if org-mobile-use-encryption
org-mobile-encryption-tempfile
target-file)
(while (setq entry (pop def-todo))
(insert "#+READONLY\n")
(setq kwds (mapcar (lambda (x) (if (string-match "(" x)
@ -447,7 +451,10 @@ agenda view showing the flagged items."
(insert (format "* [[file:%s][%s]]\n"
link-name link-name)))
(push (cons org-mobile-index-file (md5 (buffer-string)))
org-mobile-checksum-files))))
org-mobile-checksum-files))
(if org-mobile-use-encryption
(org-mobile-encrypt-and-move org-mobile-encryption-tempfile
target-file))))
(defun org-mobile-copy-agenda-files ()
"Copy all agenda files to the stage or WebDAV directory."
@ -469,17 +476,19 @@ agenda view showing the flagged items."
(when (string-match "[a-fA-F0-9]\\{30,40\\}" check)
(push (cons link-name (match-string 0 check))
org-mobile-checksum-files))))
(setq file (expand-file-name org-mobile-capture-file
org-mobile-directory))
(save-excursion
(setq buf (find-file file))
(and (= (point-min) (point-max)) (insert "\n"))
(save-buffer)
(when (and (= (point-min) (point-max)))
(insert "\n")
(save-buffer)
(when org-mobile-use-encryption
(write-file org-mobile-encryption-tempfile)
(org-mobile-encrypt-and-move org-mobile-encryption-tempfile file)))
(push (cons org-mobile-capture-file (md5 (buffer-string)))
org-mobile-checksum-files)
(when org-mobile-use-encryption
(write-file org-mobile-encryption-tempfile)
(org-mobile-encrypt-and-move org-mobile-encryption-tempfile file)))
org-mobile-checksum-files))
(kill-buffer buf)))
(defun org-mobile-write-checksums ()