From mboxrd@z Thu Jan 1 00:00:00 1970 From: hobbes@poukram.net (=?utf-8?Q?R=C3=A9mi?= Letot) Subject: org-mode-hook not called when entering org files (Was: Re: org-crypt doesn't automatically encrypt on save) Date: Fri, 12 Sep 2014 18:44:58 +0200 Message-ID: <87mwa4lred.fsf_-_@poukram.net> References: <87y4tqkkmv.fsf@poukram.net> <87egvh4v54.fsf@gmail.com> <87r3zhktm2.fsf@poukram.net> <877g18291x.fsf@gmail.com> 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]:54053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSTyH-0005VE-O3 for emacs-orgmode@gnu.org; Fri, 12 Sep 2014 12:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSTyB-0001us-Fv for emacs-orgmode@gnu.org; Fri, 12 Sep 2014 12:45:17 -0400 Received: from plane.gmane.org ([80.91.229.3]:54418) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSTyB-0001ue-AY for emacs-orgmode@gnu.org; Fri, 12 Sep 2014 12:45:11 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XSTyA-0000O0-0Q for emacs-orgmode@gnu.org; Fri, 12 Sep 2014 18:45:10 +0200 Received: from 144.175-242-81.adsl-dyn.isp.belgacom.be ([81.242.175.144]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Sep 2014 18:45:10 +0200 Received: from hobbes by 144.175-242-81.adsl-dyn.isp.belgacom.be with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Sep 2014 18:45:10 +0200 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: emacs-orgmode@gnu.org look near the end of the post for org-mode-hook specific explanation :-) Darlan Cavalcante Moreira writes: > One note first, if you change org-modules manually like that you must > make sure this change is done before org-mode is loaded. I prefer to use > the customize interface just for org-modules for that reason. Hmmm, the starter kit requires org in the very first step of initialization, so that might be the problem... I dug a bit in the doc and tried org-reload, which doesn't solve my problem... > I also add org-crypt to org-modules like you do. If I open my > password.org file and open it directly I will have the same behaviour > you get. Maybe the save magic does not work reliable when org-crypt is > loaded through org-modules, I'm not sure. I didn't know what org-modules did, so I had a look at the source (great first for me :-) Apparently it just requires the listed extensions, so requiring org-crypt does the same. > When I call my function that requires org-crypt and calls > org-crypt-use-before-save-magic before opening my password file > everything works. But I only do it like this because I have a single > file with encrypted entries and I prefer to delay loading org-crypt > initialization. I profiled my configuration some time ago and decided to > do that to reduce i little bit the initialization time. > > > Since you already require org-crypt, just add > "(org-crypt-use-before-save-magic)" after the require and see if that > solves your problem. It's already just under the require :-) Here is my complete org-crypt config: (add-to-list 'org-modules 'org-crypt) (require 'org-crypt) ; Encrypt all entries before saving (org-crypt-use-before-save-magic) (setq org-tags-exclude-from-inheritance (quote ("crypt"))) ; GPG key to use for encryption (setq org-crypt-key "730D80837333AD60") org-crypt-use-before-save-magic just populates org-mode-hook with a before-save-hook, which is correctly done in my case. The trick is that org-mode-hook doesn't seem to fire when I open an org file... confirmed: I had a look at the other variables that it should change, and they do not appear to be modified when I open an org file. all org seems to work fine, but for some reason org-mode-hook is not called when I open an org file... Changing the title as I have a more precise problem :-) Thanks, -- RĂ©mi