M etc/ORG-NEWS => etc/ORG-NEWS +4 -0
@@ 222,6 222,10 @@ execution completes. The new ~:async~ header allows users to continue
editing with Emacs while a ~:session~ block executes.
+*** =org-crypt.el= now applies initial visibility settings to decrypted entries
+Previously, all the text was unfolded unconditionally, including property drawers.
*** Blank lines after removed objects are not retained during export
When certain objects in Org document are to be excluded from export,
M lisp/org-crypt.el => lisp/org-crypt.el +10 -1
@@ 81,6 81,7 @@
(declare-function org-previous-visible-heading "org" (arg))
(declare-function org-scan-tags "org" (action matcher todo-only &optional start-level))
(declare-function org-set-property "org" (property value))
+(declare-function org-cycle-set-startup-visibility "org-cycle" ())
(defgroup org-crypt nil
@@ 269,10 270,12 @@ Assume `epg-context' is set."
(epg-decrypt-string epg-context encrypted-text)
;; Delete region starting just before point, because the
;; outline property starts at the \n of the heading.
(delete-region (1- (point)) end)
+ (setq origin-marker (point-marker))
;; Store a checksum of the decrypted and the encrypted text
;; value. This allows reusing the same encrypted text if the
;; text does not change, and therefore avoid a re-encryption
@@ 282,6 285,12 @@ Assume `epg-context' is set."
'org-crypt-checksum (sha1 decrypted-text)
+ ;; Apply initial visibility.
+ (narrow-to-region origin-marker (point))
+ (set-marker origin-marker nil)
+ ;; ... but keep the previous folded state.
M lisp/org-cycle.el => lisp/org-cycle.el +8 -7
@@ 638,20 638,21 @@ With a numeric prefix, show all headlines up to that level."
"Switch subtree visibility according to VISIBILITY property."
(let ((regexp (org-re-property "VISIBILITY")))
- (org-with-point-at 1
+ (goto-char (point-min))
(while (re-search-forward regexp nil t)
- (let ((state (match-string 3)))
+ (let ((state (match-string 3)))
(if (not (org-at-property-p)) (outline-next-heading)
;; Newline before heading will be outside the
;; narrowing. Make sure that it is revealed.
@@ 659,9 660,9 @@ With a numeric prefix, show all headlines up to that level."
- ((or "all" "showall")
+ ((or "all" "showall")
- (_ nil)))
+ (_ nil)))
(defun org-cycle-overview ()