summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-03-10 09:43:36 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-03-10 09:43:36 +0100
commit11d2b3c3f83fd4a7c17407b32529b726f3992400 (patch)
tree0eae4fae935c1f05f1dbc3fbc22538f62513eb2b
parentfda14f8d189021e97259df9e892963757c3fc6ae (diff)
downloadorg-mode-11d2b3c3f83fd4a7c17407b32529b726f3992400.tar.gz
org-crypt: Do not encrypt properties drawers
* lisp/org-crypt.el (org-encrypt-entry): Do not encrypt properties drawer, as specified in the manual. Reported-by: "Daniel E. Doherty" <ded@ddoherty.net> <http://permalink.gmane.org/gmane.emacs.orgmode/105587>
-rw-r--r--lisp/org-crypt.el44
1 files changed, 22 insertions, 22 deletions
diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index d41e80a..e2007e6 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -171,28 +171,28 @@ See `org-crypt-disable-auto-save'."
"Encrypt the content of the current headline."
(interactive)
(require 'epg)
- (save-excursion
- (org-back-to-heading t)
- (set (make-local-variable 'epg-context) (epg-make-context nil t t))
- (let ((start-heading (point)))
- (forward-line)
- (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
- (let ((folded (outline-invisible-p))
- (crypt-key (org-crypt-key-for-heading))
- (beg (point))
- end encrypted-text)
- (goto-char start-heading)
- (org-end-of-subtree t t)
- (org-back-over-empty-lines)
- (setq end (point)
- encrypted-text
- (org-encrypt-string (buffer-substring beg end) crypt-key))
- (delete-region beg end)
- (insert encrypted-text)
- (when folded
- (goto-char start-heading)
- (outline-hide-subtree))
- nil)))))
+ (org-with-wide-buffer
+ (org-back-to-heading t)
+ (set (make-local-variable 'epg-context) (epg-make-context nil t t))
+ (let ((start-heading (point)))
+ (org-end-of-meta-data)
+ (unless (looking-at "-----BEGIN PGP MESSAGE-----")
+ (let ((folded (outline-invisible-p))
+ (crypt-key (org-crypt-key-for-heading))
+ (beg (point))
+ end encrypted-text)
+ (goto-char start-heading)
+ (org-end-of-subtree t t)
+ (org-back-over-empty-lines)
+ (setq end (point)
+ encrypted-text
+ (org-encrypt-string (buffer-substring beg end) crypt-key))
+ (delete-region beg end)
+ (insert encrypted-text)
+ (when folded
+ (goto-char start-heading)
+ (outline-hide-subtree))
+ nil)))))
(defun org-decrypt-entry ()
"Decrypt the content of the current headline."