0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-30 02:30:03 +00:00

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>
This commit is contained in:
Nicolas Goaziou 2016-03-10 09:43:36 +01:00
parent fda14f8d18
commit 11d2b3c3f8

View file

@ -171,28 +171,28 @@ See `org-crypt-disable-auto-save'."
"Encrypt the content of the current headline." "Encrypt the content of the current headline."
(interactive) (interactive)
(require 'epg) (require 'epg)
(save-excursion (org-with-wide-buffer
(org-back-to-heading t) (org-back-to-heading t)
(set (make-local-variable 'epg-context) (epg-make-context nil t t)) (set (make-local-variable 'epg-context) (epg-make-context nil t t))
(let ((start-heading (point))) (let ((start-heading (point)))
(forward-line) (org-end-of-meta-data)
(when (not (looking-at "-----BEGIN PGP MESSAGE-----")) (unless (looking-at "-----BEGIN PGP MESSAGE-----")
(let ((folded (outline-invisible-p)) (let ((folded (outline-invisible-p))
(crypt-key (org-crypt-key-for-heading)) (crypt-key (org-crypt-key-for-heading))
(beg (point)) (beg (point))
end encrypted-text) end encrypted-text)
(goto-char start-heading) (goto-char start-heading)
(org-end-of-subtree t t) (org-end-of-subtree t t)
(org-back-over-empty-lines) (org-back-over-empty-lines)
(setq end (point) (setq end (point)
encrypted-text encrypted-text
(org-encrypt-string (buffer-substring beg end) crypt-key)) (org-encrypt-string (buffer-substring beg end) crypt-key))
(delete-region beg end) (delete-region beg end)
(insert encrypted-text) (insert encrypted-text)
(when folded (when folded
(goto-char start-heading) (goto-char start-heading)
(outline-hide-subtree)) (outline-hide-subtree))
nil))))) nil)))))
(defun org-decrypt-entry () (defun org-decrypt-entry ()
"Decrypt the content of the current headline." "Decrypt the content of the current headline."