1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-27 10:55:04 +00:00

org-crypt.el (org-at-encrypted-entry-p): Fix bug when the check happens before the first headline

* org-crypt.el (org-at-encrypted-entry-p): Fix bug when
the check happens before the first headline.
This commit is contained in:
Bastien Guerry 2012-09-26 08:28:32 +02:00
parent 0b65064961
commit 8fbf78d185

View File

@ -254,10 +254,11 @@ See `org-crypt-disable-auto-save'."
(defun org-at-encrypted-entry-p ()
"Is the current entry encrypted?"
(save-excursion
(org-back-to-heading t)
(search-forward "-----BEGIN PGP MESSAGE-----"
(save-excursion (org-end-of-subtree t)) t)))
(unless (org-before-first-heading-p)
(save-excursion
(org-back-to-heading t)
(search-forward "-----BEGIN PGP MESSAGE-----"
(save-excursion (org-end-of-subtree t)) t))))
(defun org-crypt-use-before-save-magic ()
"Add a hook to automatically encrypt entries before a file is saved to disk."