From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: org-crypt doesn't automatically encrypt on save Date: Thu, 11 Sep 2014 20:03:51 -0300 Message-ID: <87egvh4v54.fsf@gmail.com> References: <87y4tqkkmv.fsf@poukram.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSDPJ-0002kD-Se for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 19:04:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSDPB-0005Hj-F1 for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 19:04:05 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:58434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSDPB-0005HN-AM for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 19:03:57 -0400 Received: by mail-qg0-f42.google.com with SMTP id q107so11796551qgd.15 for ; Thu, 11 Sep 2014 16:03:56 -0700 (PDT) In-reply-to: <87y4tqkkmv.fsf@poukram.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?R=C3=A9mi?= Letot Cc: emacs-orgmode@gnu.org 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