Browse Source

org-crypt-key-for-heading: Handle CRYPTKEY nil value

* lisp/org-crypt.el (org-crypt-key-for-heading): Do not fallback to
`org-crypt-key' when heading explicitly sets CRYPTKEY property.

Reported-by: Ignacio Casso <ignaciocasso@hotmail.com>
Link: https://orgmode.org/list/PAXPR06MB7760DA356C7C27045BEB64F6C6449@PAXPR06MB7760.eurprd06.prod.outlook.com
Ihor Radchenko 1 year ago
parent
commit
d331f52cac
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lisp/org-crypt.el

+ 3 - 2
lisp/org-crypt.el

@@ -199,8 +199,9 @@ See `org-crypt-disable-auto-save'."
 Assume `epg-context' is set."
   (and org-crypt-key
        (or (epg-list-keys epg-context
-			  (or (org-entry-get nil "CRYPTKEY" 'selective)
-			      org-crypt-key))
+			  (pcase (org-entry-get nil "CRYPTKEY" 'selective 'literal-nil)
+                            ("nil" "")
+                            (key (or key org-crypt-key ""))))
 	   (bound-and-true-p epa-file-encrypt-to)
 	   (progn
 	     (message "No crypt key set, using symmetric encryption.")