On Sun, Mar 06 2011, Bastien wrote: >> What I can also suggest is to never show the encrypted block in the Org >> buffer. > > I agree this would be better. > >> This is what I do in my configuration: on Org file loading, I decrypt >> all entries. Therefore I never see the GPG block. When I save, >> everything is encrypted, written, and then re-decrypted. > > Can you share your config?
NO WAY!
But here it is:
#+begin_src emacs-listp
(org-crypt-use-before-save-magic)
(defun jd:org-decrypt-everything-silently ()
(let ((m (buffer-modified-p)))
(org-decrypt-entries)
(unless m
(set-buffer-modified-p nil))))
(add-hook 'org-mode-hook 'jd:org-decrypt-everything-silently)
(add-hook 'org-mode-hook (lambda ()
(add-hook 'after-save-hook
'jd:org-decrypt-everything-silently)))
#+end_src
- Loading org-mode on a file decrypt everything;
- Saving encrypt everything (org-crypt-use-before-save-magic adds this);
- After-saving we re-decrypt.
Using this method with auto-save-hook should be possible.
> I see: auto-save-hook would encrypt, write to ~/.#file# then decrypt the
> original buffer back again -- yes?
Yup.
--
Julien Danjou
❱ http://julien.danjou.info
pgpBtB6nbXOtp.pgp
Description: PGP signature
