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
This commit is contained in:
Ihor Radchenko 2022-10-14 10:12:56 +08:00
parent 3e86487755
commit d331f52cac
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 2 deletions

View File

@ -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.")