summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-10-13 10:48:35 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-10-13 10:48:35 +0200
commit9755e09bbcd630b6d0e20dbf6342bf1c1e66c819 (patch)
treeefc6e54dafedd3d7b0a341e09dff2c4b80a25d06
parent5014288b680b00a639386518ee258846f0d10255 (diff)
downloadorg-mode-9755e09bbcd630b6d0e20dbf6342bf1c1e66c819.tar.gz
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.
-rw-r--r--doc/org.texi4
-rw-r--r--lisp/org-mobile.el25
2 files changed, 20 insertions, 9 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 801bf12..89b7178 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -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
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index af3493d..9208d30 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -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 ()