emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Darlan Cavalcante Moreira <darcamo@gmail.com>
To: "Rémi Letot" <hobbes@poukram.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-crypt doesn't automatically encrypt on save
Date: Thu, 11 Sep 2014 20:03:51 -0300	[thread overview]
Message-ID: <87egvh4v54.fsf@gmail.com> (raw)
In-Reply-To: <87y4tqkkmv.fsf@poukram.net>


You need to load org-crypt and call org-crypt-use-before-save-magic
before you open the org file.

For instance, my configuration for org-crypt is
--8<---------------cut here---------------start------------->8---
(autoload 'org-decrypt-entry "org-crypt.el" "Decrypt the content of the current headline." t)
(autoload 'org-decrypt-entries "org-crypt.el" "Decrypt all entries in the current buffer." t)
(autoload 'org-encrypt-entry "org-crypt.el" "Encrypt the content of the current headline." t)
(autoload 'org-encrypt-entries "org-crypt.el" "Encrypt all top-level entries in the current buffer." t)

(with-eval-after-load "org-crypt"
  ;; Automatically encrypts everything that has the tag "crypt"
  ;; when you save the file
  (org-crypt-use-before-save-magic)
  (setq org-tags-exclude-from-inheritance (quote ("crypt" "Project")))
  (setq org-crypt-key "8NUMBERS")
  (setq org-crypt-disable-auto-save t)
  )
--8<---------------cut here---------------end--------------->8---

Only this gives the same problem you have. When I decrypt an entry
org-crypt is finally loaded but since I'm already visiting the file then
the save magic will not kick in. In my case I only have one file where I
use org-crypt and I define the function below

--8<---------------cut here---------------start------------->8---
(defun my-find-senhas-org-heading nil
  (interactive)
  (require 'org-crypt)
  (find-file "~/org/passwords.org")
  )
--8<---------------cut here---------------end--------------->8---

If I often used org-crypt in any org file I would always require
org-crypt and call org-crypt-use-before-save-magic in my Emacs
configuration, but since I only use for this particular file, then
defining a function to visit this file works better for me.


hobbes@poukram.net writes:

> Hello org-mode World,
>
> is anyone successfully using org-crypt with
> org-crypt-use-before-save-magic ?
>
> I set it up as per the docs, but apparently the org-mode
> before-save-hook is not populated with org-encrypt-entries as it should
> when I open an org buffer, meaning that crypt tagged headlines are not
> encrypted when I save the file
>
> *but* it works if I manually call M-x org-mode after opening the file...
>
> In summary:
>
> C-x C-f test.org / M-x org-decrypt-entry / C-x C-s does not reencrypt
> the entry
>
> C-x C-f test.org / M-x org-mode / M-x org-decrypt-entry / C-x C-s does
> work as expected.
>
> Any idea ?
>
> I'm using the Emacs Starter Kit, so that might interfere, but I can't
> see how and where...
>
> Thanks,
> --
> Rémi


-- 
Darlan Cavalcante Moreira
darcamo@gmail.com

  reply	other threads:[~2014-09-11 23:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 19:44 org-crypt doesn't automatically encrypt on save Rémi Letot
2014-09-11 23:03 ` Darlan Cavalcante Moreira [this message]
2014-09-12 10:42   ` Rémi Letot
2014-09-12 14:23     ` Darlan Cavalcante Moreira
2014-09-12 16:44       ` org-mode-hook not called when entering org files (Was: Re: org-crypt doesn't automatically encrypt on save) Rémi Letot
2014-09-12 18:15         ` org-mode-hook not called when entering org files Nick Dokos
2014-09-13 19:24           ` Rémi Letot
2014-09-15 21:33             ` Nick Dokos
2014-09-16  8:27               ` Rémi Letot
2014-09-16 14:27                 ` Nick Dokos
2014-09-15 21:45             ` Nick Dokos
2014-09-12 14:42   ` org-crypt doesn't automatically encrypt on save Jorge A. Alfaro-Murillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egvh4v54.fsf@gmail.com \
    --to=darcamo@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=hobbes@poukram.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).