summaryrefslogtreecommitdiff
path: root/lisp/org-crypt.el
diff options
context:
space:
mode:
authorNicholas D Steeves <nsteeves@gmail.com>2017-07-03 20:44:19 -0400
committerNicholas D Steeves <nsteeves@gmail.com>2017-07-03 20:57:31 -0400
commit3458b4fdfffc1b4f542405325ffa8b6eed0eb1df (patch)
tree0c9ed6fcddc796bdb92d3fc5fd266fac3b583eda /lisp/org-crypt.el
parent969f455bc143bb93c745b82db358392b123661e0 (diff)
New upstream version 9.0.9+dfsg
Diffstat (limited to 'lisp/org-crypt.el')
-rw-r--r--lisp/org-crypt.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index 1039996..3c431e4 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -1,5 +1,5 @@
;;; org-crypt.el --- Public Key Encryption for Org Entries -*- lexical-binding: t; -*-
-;; Copyright (C) 2007-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
;; Emacs Lisp Archive Entry
;; Filename: org-crypt.el
@@ -176,14 +176,18 @@ See `org-crypt-disable-auto-save'."
(let ((start-heading (point)))
(org-end-of-meta-data)
(unless (looking-at-p "-----BEGIN PGP MESSAGE-----")
- (let ((folded (outline-invisible-p))
+ (let ((folded (org-invisible-p))
(crypt-key (org-crypt-key-for-heading))
(beg (point)))
(goto-char start-heading)
(org-end-of-subtree t t)
(org-back-over-empty-lines)
(let ((contents (delete-and-extract-region beg (point))))
- (insert (org-encrypt-string contents crypt-key)))
+ (condition-case err
+ (insert (org-encrypt-string contents crypt-key))
+ ;; If encryption failed, make sure to insert back entry
+ ;; contents in the buffer.
+ (error (insert contents) (error (nth 1 err)))))
(when folded
(goto-char start-heading)
(outline-hide-subtree))
@@ -200,7 +204,7 @@ See `org-crypt-disable-auto-save'."
(heading-was-invisible-p
(save-excursion
(outline-end-of-heading)
- (outline-invisible-p))))
+ (org-invisible-p))))
(org-end-of-meta-data)
(when (looking-at "-----BEGIN PGP MESSAGE-----")
(org-crypt-check-auto-save)