2 ms·
I use pass nowadays but used to use org for passwords, but in my setup I used to only encrypt the contents of entries, i.e. headings were in plain text. Then I
by gkya 9y ago
I use pass nowadays but used to use org for passwords, but in my setup I used to only encrypt the contents of entries, i.e. headings were in plain text. Then I used the function below to decrypt them. Made it easier to browse the file.
(cl-defun gk-org-decrypt-element ()
"Decrypt the element under point, show in a new buffer."
(interactive)
(save-excursion
(let ((transient-mark-mode t))
(org-mark-element)
(epa-decrypt-region
(region-beginning) (region-end)
(lambda ()
(let ((decrypted-elem (org-get-heading t t))
(bufnam (buffer-name)))
(prog1
(switch-to-buffer (get-buffer-create "*Org Secret*"))
(read-only-mode -1)
(fundamental-mode)
(erase-buffer)
(insert ">>> " decrypted-elem " (" bufnam ")")
(newline)
(insert ">>> Hit `Q' in order to *kill* this buffer.")
(newline 2)
(special-mode)
(local-set-key [?Q] 'kill-this-buffer))))))))