From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bill Day Subject: Documentation suggestion re: buffers containing crypted entries Date: Sat, 30 Apr 2011 17:34:06 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00151750e374d2a5cb04a2298c45 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGHnm-0001D7-CE for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 17:34:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGHnl-0001LS-9N for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 17:34:10 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:35930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGHnl-0001L2-0I for emacs-orgmode@gnu.org; Sat, 30 Apr 2011 17:34:09 -0400 Received: by bwz17 with SMTP id 17so4849546bwz.0 for ; Sat, 30 Apr 2011 14:34:06 -0700 (PDT) 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 --00151750e374d2a5cb04a2298c45 Content-Type: text/plain; charset=ISO-8859-1 I appreciate the warning about encrypted entries, and, I would like to add, all the hard work and careful thought that has gone into making org-mode such an incredible piece of software. I checked the documentation regarding turning off auto-save on pages containing encrypted entries and saw that the warning was repeated but there was no advice on how to implement it. See http://orgmode.org/worg/org-tutorials/encrypting-files.html My eventual solution (there may be better ones) was to add a line at the top of my encrypted page as follows: # -*- buffer-auto-save-file-name: nil; -*- This itself generates a warning every time I go to that page, but it seems to inhibit auto-save. I would like to suggest that a little bit of explanation of how to turn auto-save on and off be added to the documentation on encryption with org-mode. Thank you. Sincerely, Bill Day -- Bill Day williamson.day@gmail.com --00151750e374d2a5cb04a2298c45 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I appreciate the warning about encrypted entries, and, I would like to add,= all the hard work and careful thought that has gone into making org-mode s= uch an incredible piece of software.

I checked the documentation reg= arding turning off auto-save on pages containing encrypted entries and saw = that the warning was repeated but there was no advice on how to implement i= t.=A0 See http://orgmode.org/worg/org-tutorials/encrypting-files.html

My eventual solution (there may be better ones) was to add a line at th= e top of my encrypted page as follows:

# -*- buffer-auto-save-file-n= ame: nil; -*-

This itself generates a warning every time I go to tha= t page, but it seems to inhibit auto-save. I would like to suggest that a l= ittle bit of explanation of how to turn auto-save on and off be added to th= e documentation on encryption with org-mode.

Thank you.

Sincerely,

Bill Day

-- Bill Day
williamson.day@gm= ail.com
--00151750e374d2a5cb04a2298c45-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Mon, 02 May 2011 00:42:17 -0300 Message-ID: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGk1h-0007S5-Rl for emacs-orgmode@gnu.org; Sun, 01 May 2011 23:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGk1h-0006vV-1A for emacs-orgmode@gnu.org; Sun, 01 May 2011 23:42:25 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:60269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGk1g-0006vR-TD for emacs-orgmode@gnu.org; Sun, 01 May 2011 23:42:24 -0400 Received: by gwaa12 with SMTP id a12so2229054gwa.0 for ; Sun, 01 May 2011 20:42:23 -0700 (PDT) In-Reply-To: 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: Bill Day Cc: emacs-orgmode@gnu.org I was hit by this last week when I was investigating why my emacs initialization was taking so long. Later I found out that org-crypt was the culprit, since it added a "sit for 5s" in order for the user to actually see this warning. The problem is that org-crypt tests the value of the auto-save-default variable during loading time. This reflects the default behavior and not the actual auto-save status of the current buffer. Maybe a variable to disable this warning could be introduced so that the user could disable it after understanding the problem. -- Darlan At Sat, 30 Apr 2011 17:34:06 -0400, Bill Day wrote: > > [1 ] > I appreciate the warning about encrypted entries, and, I would like to add, > all the hard work and careful thought that has gone into making org-mode > such an incredible piece of software. > > I checked the documentation regarding turning off auto-save on pages > containing encrypted entries and saw that the warning was repeated but there > was no advice on how to implement it. See > http://orgmode.org/worg/org-tutorials/encrypting-files.html > > My eventual solution (there may be better ones) was to add a line at the top > of my encrypted page as follows: > > # -*- buffer-auto-save-file-name: nil; -*- > > This itself generates a warning every time I go to that page, but it seems > to inhibit auto-save. I would like to suggest that a little bit of > explanation of how to turn auto-save on and off be added to the > documentation on encryption with org-mode. > > Thank you. > > Sincerely, > > Bill Day > > -- > Bill Day > williamson.day@gmail.com > [2 ] > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Abrahams Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Sun, 12 Jun 2011 16:41:34 -0400 Message-ID: References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVrTj-0002UZ-96 for emacs-orgmode@gnu.org; Sun, 12 Jun 2011 16:41:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QVrTh-0007Ag-I7 for emacs-orgmode@gnu.org; Sun, 12 Jun 2011 16:41:51 -0400 Received: from lo.gmane.org ([80.91.229.12]:49877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QVrTh-0007AL-5Q for emacs-orgmode@gnu.org; Sun, 12 Jun 2011 16:41:49 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QVrTg-0003ev-6T for emacs-orgmode@gnu.org; Sun, 12 Jun 2011 22:41:48 +0200 Received: from 207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com ([207.172.223.249]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 12 Jun 2011 22:41:48 +0200 Received: from dave by 207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 12 Jun 2011 22:41:48 +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 > I was hit by this last week when I was investigating why my emacs > initialization was taking so long. Later I found out that org-crypt was the > culprit, since it added a "sit for 5s" in order for the user to actually > see this warning. > > The problem is that org-crypt tests the value of the auto-save-default > variable during loading time. This reflects the default behavior and not > the actual auto-save status of the current buffer. > > Maybe a variable to disable this warning could be introduced so that the > user could disable it after understanding the problem. Oh, yes please! I'm finding the delays introduced by this problem almost intolerable. Call me picky but I've gone to great lengths to make emacs very responsive and this sit-for really interferes! -- Dave Abrahams BoostPro Computing http://www.boostpro.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Fri, 24 Jun 2011 11:04:36 +0100 Message-ID: <8762nv5yvf.fsf@ucl.ac.uk> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa3Fl-0000kB-0t for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa3Fj-000822-A2 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:04:44 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:48352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa3Fi-00081l-UF for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:04:43 -0400 In-Reply-To: (Dave Abrahams's message of "Sun, 12 Jun 2011 16:41:34 -0400") 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: Dave Abrahams Cc: emacs-orgmode@gnu.org Dave Abrahams writes: >> I was hit by this last week when I was investigating why my emacs >> initialization was taking so long. Later I found out that org-crypt was the > >> culprit, since it added a "sit for 5s" in order for the user to actually >> see this warning. >> >> The problem is that org-crypt tests the value of the auto-save-default >> variable during loading time. This reflects the default behavior and not >> the actual auto-save status of the current buffer. >> >> Maybe a variable to disable this warning could be introduced so that the >> user could disable it after understanding the problem. > > Oh, yes please! I'm finding the delays introduced by this problem > almost intolerable. Call me picky but I've gone to great lengths to > make emacs very responsive and this sit-for really interferes! +1 I have found this (sit-for 5) annoying enough that I have deleted it from my copy of org. 5 seconds is a large percentage of my emacs start up time! thanks, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.430.g95fa2.dirty) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Fri, 24 Jun 2011 07:57:01 -0400 Message-ID: <87y60rsar6.fsf@norang.ca> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> <8762nv5yvf.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa50h-0006GE-IG for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 07:57:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa50c-0007aa-9o for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 07:57:19 -0400 Received: from mho-04-ewr.mailhop.org ([204.13.248.74]:62037 helo=mho-02-ewr.mailhop.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa50b-0007ZJ-70 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 07:57:13 -0400 In-Reply-To: <8762nv5yvf.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 24 Jun 2011 11:04:36 +0100") 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: Eric S Fraga Cc: Dave Abrahams , emacs-orgmode@gnu.org Eric S Fraga writes: > Dave Abrahams writes: > >>> I was hit by this last week when I was investigating why my emacs >>> initialization was taking so long. Later I found out that org-crypt was the >> >>> culprit, since it added a "sit for 5s" in order for the user to actually >>> see this warning. >>> >>> The problem is that org-crypt tests the value of the auto-save-default >>> variable during loading time. This reflects the default behavior and not >>> the actual auto-save status of the current buffer. >>> >>> Maybe a variable to disable this warning could be introduced so that the >>> user could disable it after understanding the problem. >> >> Oh, yes please! I'm finding the delays introduced by this problem >> almost intolerable. Call me picky but I've gone to great lengths to >> make emacs very responsive and this sit-for really interferes! > > +1 > > I have found this (sit-for 5) annoying enough that I have deleted it > from my copy of org. 5 seconds is a large percentage of my emacs start > up time! I also have removed this wait in my local copy of org-mode. I use org-crypt for one subtree in each of my org files which contains passwords and other sensitive data. I rarely decrypt these entries so leaving auto save on for my use case isn't much of a security issue for me. I tend to decrypt the entry, look up the detail I need, and then resave the file which reencrypts the entry immediately. Just my 2 cents :) -- Bernt From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Fri, 24 Jun 2011 12:53:57 +0200 Message-ID: <87hb7febzu.fsf@gnu.org> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> <8762nv5yvf.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa40w-0005Tk-M6 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:53:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa40u-0008JZ-L5 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:53:30 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:55592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa40u-0008JR-4T for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 06:53:28 -0400 Received: by wwf22 with SMTP id 22so2220771wwf.30 for ; Fri, 24 Jun 2011 03:53:27 -0700 (PDT) In-Reply-To: <8762nv5yvf.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 24 Jun 2011 11:04:36 +0100") 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: Dave Abrahams Cc: emacs-orgmode@gnu.org Eric S Fraga writes: > I have found this (sit-for 5) annoying enough that I have deleted it > from my copy of org. 5 seconds is a large percentage of my emacs start > up time! I just reduced it to one second. Still, the message needs some time to appear to the user. -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Fri, 24 Jun 2011 14:42:55 +0100 Message-ID: <878vsrxs4g.fsf@ucl.ac.uk> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> <8762nv5yvf.fsf@ucl.ac.uk> <87hb7febzu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa6f4-0000X3-L9 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 09:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa6f2-00008m-KZ for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 09:43:06 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:49268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa6f2-00008F-1U for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 09:43:04 -0400 In-Reply-To: <87hb7febzu.fsf@gnu.org> (Bastien's message of "Fri, 24 Jun 2011 12:53:57 +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: Bastien Cc: Dave Abrahams , emacs-orgmode@gnu.org Bastien writes: > Eric S Fraga writes: > >> I have found this (sit-for 5) annoying enough that I have deleted it >> from my copy of org. 5 seconds is a large percentage of my emacs start >> up time! > > I just reduced it to one second. Still, the message needs some time to > appear to the user. The question is where should this information be most appropriate to appear. In my view, this should be in the documentation (highlighted etc), not in the Emacs mini-buffer! I don't know enough texi (any at all, actually) so cannot suggest a patch. However, I would suggest that the warning that is in the code be moved into the entry for org-crypt.el in the info manual. Or, as originally proposed, the warning in the code could be wrapped in a customisable variable but this seems like overkill to me. One quickly becomes inured to messages that appear every time you use a tool. At best, they are simply ignored; at worst, they become annoying, such as in this case. I'm not complaining critically as it is trivial to fix for my own use. Just my 2=C2=A2! --=20 : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.430.g95fa2.dirty) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pieter Praet Subject: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Fri, 24 Jun 2011 23:03:42 +0200 Message-ID: <1308949422-30288-1-git-send-email-pieter@praet.org> References: <87hb7febzu.fsf@gnu.org> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDXe-00084X-Bh for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaDXa-0001rY-T2 for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:03:54 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:48528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDXa-0001rB-HH for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:03:50 -0400 Received: by wyg36 with SMTP id 36so2654652wyg.0 for ; Fri, 24 Jun 2011 14:03:48 -0700 (PDT) In-Reply-To: <87hb7febzu.fsf@gnu.org> 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 Cc: Dave Abrahams , Bastien As auto-save-mode can only cause leakage after org-decrypt has been run, there's no need to check for it (and potentially cause annoyance) so early. Unfortunately, auto-save-mode doesn't set a buffer-local var to indicate whether it's enabled for the current buffer (checking `buffer-auto-save-file-name' has proven to be unreliable), so we can only check whether it's enabled globally, using `auto-save-default'. Signed-off-by: Pieter Praet --- lisp/org-crypt.el | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 4bff7a1..f4c0b8e 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -142,6 +142,10 @@ This setting can also be overridden in the CRYPTKEY property." (defun org-decrypt-entry () "Decrypt the content of the current headline." (interactive) + (when + (or + (not auto-save-default) + (yes-or-no-p "WARNING: auto-save-mode is enabled globally. This may cause leakage. Continue? ")) (require 'epg) (unless (org-before-first-heading-p) (save-excursion @@ -179,7 +183,7 @@ This setting can also be overridden in the CRYPTKEY property." (when heading-was-invisible-p (goto-char heading-point) (org-flag-subtree t)) - nil)))))) + nil))))))) (defun org-encrypt-entries () "Encrypt all top-level entries in the current buffer." @@ -209,10 +213,10 @@ This setting can also be overridden in the CRYPTKEY property." ;; 'org-mode-hook ;; (lambda () (add-hook 'auto-save-hook 'org-encrypt-entries nil t)))) -(when (and (functionp 'daemonp) - (not (daemonp)) auto-save-default) - (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") - (sit-for 1)) +;; (when (and (functionp 'daemonp) +;; (not (daemonp)) auto-save-default) +;; (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") +;; (sit-for 1)) (add-hook 'org-reveal-start-hook 'org-decrypt-entry) -- 1.7.4.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Fri, 24 Jun 2011 17:50:04 -0400 Message-ID: <11546.1308952204@alphaville.dokosmarshall.org> References: <87hb7febzu.fsf@gnu.org> <1308949422-30288-1-git-send-email-pieter@praet.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaEGn-0000WE-8N for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaEGl-0000ty-HU for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:50:32 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:50818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaEGl-0000tp-DL for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 17:50:31 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LNB004W4DZHTZ20@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 24 Jun 2011 16:50:17 -0500 (CDT) In-reply-to: Message from Pieter Praet of "Fri, 24 Jun 2011 23:03:42 +0200." <1308949422-30288-1-git-send-email-pieter@praet.org> 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: Pieter Praet Cc: Dave Abrahams , Bastien , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Pieter Praet wrote: > As auto-save-mode can only cause leakage after org-decrypt has been run, > there's no need to check for it (and potentially cause annoyance) so early. > > Unfortunately, auto-save-mode doesn't set a buffer-local var to indicate > whether it's enabled for the current buffer (checking > `buffer-auto-save-file-name' has proven to be unreliable), so we can > only check whether it's enabled globally, using `auto-save-default'. > That's very nice, but I think you can go one step further: Why not turn auto-save-mode off for the buffer when org-decrypt is called? With a warning that says so and says why, of course. Nick > Signed-off-by: Pieter Praet > --- > lisp/org-crypt.el | 14 +++++++++----- > 1 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el > index 4bff7a1..f4c0b8e 100644 > --- a/lisp/org-crypt.el > +++ b/lisp/org-crypt.el > @@ -142,6 +142,10 @@ This setting can also be overridden in the CRYPTKEY property." > (defun org-decrypt-entry () > "Decrypt the content of the current headline." > (interactive) > + (when > + (or > + (not auto-save-default) > + (yes-or-no-p "WARNING: auto-save-mode is enabled globally. This may cause leakage. Continue? ")) > (require 'epg) > (unless (org-before-first-heading-p) > (save-excursion > @@ -179,7 +183,7 @@ This setting can also be overridden in the CRYPTKEY property." > (when heading-was-invisible-p > (goto-char heading-point) > (org-flag-subtree t)) > - nil)))))) > + nil))))))) > > (defun org-encrypt-entries () > "Encrypt all top-level entries in the current buffer." > @@ -209,10 +213,10 @@ This setting can also be overridden in the CRYPTKEY property." > ;; 'org-mode-hook > ;; (lambda () (add-hook 'auto-save-hook 'org-encrypt-entries nil t)))) > > -(when (and (functionp 'daemonp) > - (not (daemonp)) auto-save-default) > - (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") > - (sit-for 1)) > +;; (when (and (functionp 'daemonp) > +;; (not (daemonp)) auto-save-default) > +;; (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") > +;; (sit-for 1)) > > (add-hook 'org-reveal-start-hook 'org-decrypt-entry) > > -- > 1.7.4.1 > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pieter Praet Subject: Re: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Sun, 26 Jun 2011 08:38:12 +0200 Message-ID: <8762ntjdwr.fsf@praet.org> References: <87hb7febzu.fsf@gnu.org> <1308949422-30288-1-git-send-email-pieter@praet.org> <11546.1308952204@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qaiz7-0007ZF-Ag for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 02:38:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qaiz4-0003e2-WF for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 02:38:20 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:34170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qaiz3-0003dA-Uq for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 02:38:18 -0400 Received: by wyg36 with SMTP id 36so3207912wyg.0 for ; Sat, 25 Jun 2011 23:38:16 -0700 (PDT) In-Reply-To: <11546.1308952204@alphaville.dokosmarshall.org> 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 Cc: Dave Abrahams , Bastien , nicholas.dokos@hp.com, emacs-orgmode@gnu.org On Fri, 24 Jun 2011 17:50:04 -0400, Nick Dokos wrote: > Pieter Praet wrote: > > > As auto-save-mode can only cause leakage after org-decrypt has been run, > > there's no need to check for it (and potentially cause annoyance) so early. > > > > Unfortunately, auto-save-mode doesn't set a buffer-local var to indicate > > whether it's enabled for the current buffer (checking > > `buffer-auto-save-file-name' has proven to be unreliable), so we can > > only check whether it's enabled globally, using `auto-save-default'. > > > > That's very nice, but I think you can go one step further: Why not turn > auto-save-mode off for the buffer when org-decrypt is called? With a > warning that says so and says why, of course. Ideally, we'd have a defcustom `org-crypt-auto-save' with the following options: - 'ask : Ask the user whether or not to decrypt the entry. - 'disable : Disable auto-save-mode for the current buffer before decrypting. - 'ignore : Decrypt the entry regardless. - 'encrypt : Re-encrypt the entries before auto-save kicks in. I've implemented this, but it fails miserably: Since the function `auto-save-mode' doesn't set an buffer-local var to indicate whether or not it's enabled for the current buffer, we can only check for `auto-save-default'. This poses the following problems: - 'ask will be a serious whiner, prompting the user for each and every entry being decrypted, whether or not `auto-save-mode' is enabled for the current buffer. - 'disable will cause (perhaps minor) performance issues, since it will try disabling `auto-save-mode' for each and every entry being decrypted, even though it may already be disabled for the current buffer. If (as per your suggestion) emitting a warning, this will also spam the *Message* buffer to no end. Also, 'encrypt will simply not work, due to `auto-save-hook' not being called when it's supposed to. BTW: For those of us running `org-decrypt-entry' with a wrapper function, do remember one has to call (auto-save-mode -1) instead of (auto-save-mode nil), since the latter will *toggle* instead of *disable* ! > Nick > > > Signed-off-by: Pieter Praet > > --- > > lisp/org-crypt.el | 14 +++++++++----- > > 1 files changed, 9 insertions(+), 5 deletions(-) > > > > diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el > > index 4bff7a1..f4c0b8e 100644 > > --- a/lisp/org-crypt.el > > +++ b/lisp/org-crypt.el > > @@ -142,6 +142,10 @@ This setting can also be overridden in the CRYPTKEY property." > > (defun org-decrypt-entry () > > "Decrypt the content of the current headline." > > (interactive) > > + (when > > + (or > > + (not auto-save-default) > > + (yes-or-no-p "WARNING: auto-save-mode is enabled globally. This may cause leakage. Continue? ")) > > (require 'epg) > > (unless (org-before-first-heading-p) > > (save-excursion > > @@ -179,7 +183,7 @@ This setting can also be overridden in the CRYPTKEY property." > > (when heading-was-invisible-p > > (goto-char heading-point) > > (org-flag-subtree t)) > > - nil)))))) > > + nil))))))) > > > > (defun org-encrypt-entries () > > "Encrypt all top-level entries in the current buffer." > > @@ -209,10 +213,10 @@ This setting can also be overridden in the CRYPTKEY property." > > ;; 'org-mode-hook > > ;; (lambda () (add-hook 'auto-save-hook 'org-encrypt-entries nil t)))) > > > > -(when (and (functionp 'daemonp) > > - (not (daemonp)) auto-save-default) > > - (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") > > - (sit-for 1)) > > +;; (when (and (functionp 'daemonp) > > +;; (not (daemonp)) auto-save-default) > > +;; (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") > > +;; (sit-for 1)) > > > > (add-hook 'org-reveal-start-hook 'org-decrypt-entry) > > > > -- > > 1.7.4.1 > > > > Peace -- Pieter From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pieter Praet Subject: [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable) Date: Sun, 26 Jun 2011 10:38:04 +0200 Message-ID: <1309077484-1707-1-git-send-email-pieter@praet.org> References: <8762ntjdwr.fsf@praet.org> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qakr7-0000aq-9c for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 04:38:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qakr5-0007ep-W3 for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 04:38:13 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:42050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qakr5-0007ej-QX for emacs-orgmode@gnu.org; Sun, 26 Jun 2011 04:38:11 -0400 Received: by wyg36 with SMTP id 36so3239742wyg.0 for ; Sun, 26 Jun 2011 01:38:10 -0700 (PDT) In-Reply-To: <8762ntjdwr.fsf@praet.org> 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 Cc: Dave Abrahams , Bastien , Nick Dokos Signed-off-by: Pieter Praet --- This is appears to be the only solution that doesn't cause the production of inordinate amounts of cortisol. I've also added a warning re the broken state of `auto-save-hook'. lisp/org-crypt.el | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-) diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 4bff7a1..0a0ce96 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -94,6 +94,15 @@ This setting can also be overridden in the CRYPTKEY property." :type 'string :group 'org-crypt) +(defcustom org-crypt-disable-auto-save t + "What org-decrypt should do if `auto-save-default' is enabled. + +t : Disable it for the current buffer prior to decrypting an entry. +nil : Leave it enabled." + :group 'org-crypt + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil))) + (defun org-crypt-key-for-heading () "Return the encryption key for the current heading." (save-excursion @@ -142,6 +151,24 @@ This setting can also be overridden in the CRYPTKEY property." (defun org-decrypt-entry () "Decrypt the content of the current headline." (interactive) + + ; auto-save-mode causes leakage, so check whether it's enabled. + (when auto-save-default + ; Ideally, we'd check whether it's enabled for the current buffer, + ; using the buffer-local variable `auto-save-mode', but the + ; `auto-save-mode' function doesn't set this, so we have to check + ; the global variable `auto-save-default' instead. + ; Consequently, the following will run regardless of whether + ; `auto-save-mode' is enabled for the current buffer, spamming the + ; *Messages* buffer. + (if (eq org-crypt-disable-auto-save t) + (progn + (message "org-decrypt: Disabling auto-save-mode for current buffer to prevent leakage.") + ; The argument to auto-save-mode has to be "-1", since + ; giving a "nil" argument toggles instead of disabling. + (auto-save-mode -1)) + (message "org-decrypt: WARNING! auto-save-mode is enabled globally. This may cause leakage."))) + (require 'epg) (unless (org-before-first-heading-p) (save-excursion @@ -204,15 +231,16 @@ This setting can also be overridden in the CRYPTKEY property." ;; FIXME Find a better way to encrypt Org auto-saved buffers? ;; When `auto-save-default' is non-nil, make sure entries are ;; encrypted before auto-saving +;; NOTE: auto-save-hook does NOT work, so don't rely on it! ;; (when auto-save-default ;; (add-hook ;; 'org-mode-hook ;; (lambda () (add-hook 'auto-save-hook 'org-encrypt-entries nil t)))) -(when (and (functionp 'daemonp) - (not (daemonp)) auto-save-default) - (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") - (sit-for 1)) +;; (when (and (functionp 'daemonp) +;; (not (daemonp)) auto-save-default) +;; (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") +;; (sit-for 1)) (add-hook 'org-reveal-start-hook 'org-decrypt-entry) -- 1.7.4.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Mon, 27 Jun 2011 18:55:40 +0200 Message-ID: <8762nrusc3.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbF5g-0004dC-Ks for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:55:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbF5d-0004bU-36 for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:55:16 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:35519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbF5c-0004bM-Ov for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:55:12 -0400 Received: by wyg36 with SMTP id 36so4073821wyg.0 for ; Mon, 27 Jun 2011 09:55:11 -0700 (PDT) In-Reply-To: (Bill Day's message of "Sat, 30 Apr 2011 17:34:06 -0400") 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: Bill Day Cc: emacs-orgmode@gnu.org Hi Bill, Bill Day writes: > # -*- buffer-auto-save-file-name: nil; -*- Do you know if this hack works for recent Emacsen without side-effects? -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Mon, 27 Jun 2011 18:31:58 +0200 Message-ID: <87pqlzutfl.fsf@gnu.org> References: <87hb7febzu.fsf@gnu.org> <1308949422-30288-1-git-send-email-pieter@praet.org> <11546.1308952204@alphaville.dokosmarshall.org> <8762ntjdwr.fsf@praet.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbEij-0006fz-6L for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbEig-0000WX-Bm for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:31:32 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:39011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbEig-0000WJ-05 for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:31:30 -0400 Received: by wyg36 with SMTP id 36so4056766wyg.0 for ; Mon, 27 Jun 2011 09:31:29 -0700 (PDT) In-Reply-To: <8762ntjdwr.fsf@praet.org> (Pieter Praet's message of "Sun, 26 Jun 2011 08:38:12 +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: Pieter Praet Cc: Dave Abrahams , Nick Dokos , emacs-orgmode@gnu.org Hi Pieter, Thanks for the patch at the end of this thread. Pieter Praet writes: > Ideally, we'd have a defcustom `org-crypt-auto-save' with the following options: > - 'ask : Ask the user whether or not to decrypt the entry. > - 'disable : Disable auto-save-mode for the current buffer before decrypting. > - 'ignore : Decrypt the entry regardless. > - 'encrypt : Re-encrypt the entries before auto-save kicks in. > > I've implemented this, but it fails miserably: > > Since the function `auto-save-mode' doesn't set an buffer-local > var to indicate whether or not it's enabled for the current buffer, we > can only check for `auto-save-default'. I think we should first ask emacs-devel to fix this, then implement your clean solution. Would you like to report this problem? I'm not confident in disabling auto-save-mode globally by default, this would surprise users -- even with a **BiG WaRnInG** message. What do you think? -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Mon, 27 Jun 2011 18:56:54 +0200 Message-ID: <87wrg7tdpl.fsf@altern.org> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> <8762nv5yvf.fsf@ucl.ac.uk> <87hb7febzu.fsf@gnu.org> <878vsrxs4g.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbF6q-0004ux-Fk for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:56:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbF6o-0004pP-Kq for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:56:28 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:51379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbF6o-0004mk-8d for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 12:56:26 -0400 Received: by wwf22 with SMTP id 22so3934752wwf.30 for ; Mon, 27 Jun 2011 09:56:25 -0700 (PDT) In-Reply-To: <878vsrxs4g.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 24 Jun 2011 14:42:55 +0100") 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: Dave Abrahams Cc: emacs-orgmode@gnu.org Hi Eric, Eric S Fraga writes: > The question is where should this information be most appropriate to > appear. In my view, this should be in the documentation (highlighted > etc), not in the Emacs mini-buffer! I don't know enough texi (any at > all, actually) so cannot suggest a patch. However, I would suggest that > the warning that is in the code be moved into the entry for org-crypt.el > in the info manual. I did so -- I added this to the config example in org.texi: ,---- | (setq auto-save-default nil) | ;; Auto-saving does not cooperate with org-crypt.el: so you need | ;; to turn it off if you plan to use org-crypt.el quite often. | ;; Otherwise, you'll get an (annoying) message each time you | ;; start Org. | | ;; To turn it off only locally, you can insert this: | ;; | ;; # -*- buffer-auto-save-file-name: nil; -*- `---- > Or, as originally proposed, the warning in the code > could be wrapped in a customisable variable but this seems like overkill > to me. To me too, unless we have a clean way to disable auto-save-mode locally. > Just my 2¢! 2thx! -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pieter Praet Subject: Re: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Tue, 28 Jun 2011 08:55:46 +0200 Message-ID: <87k4c6fnrh.fsf@praet.org> References: <87hb7febzu.fsf@gnu.org> <1308949422-30288-1-git-send-email-pieter@praet.org> <11546.1308952204@alphaville.dokosmarshall.org> <8762ntjdwr.fsf@praet.org> <87pqlzutfl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbSDV-0002AZ-9K for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:56:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbSDT-0006MN-5T for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:56:13 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:44633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbSDS-0006MD-Q3 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:56:11 -0400 Received: by wwf22 with SMTP id 22so4332164wwf.30 for ; Mon, 27 Jun 2011 23:56:09 -0700 (PDT) In-Reply-To: <87pqlzutfl.fsf@gnu.org> 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: Bastien Cc: Dave Abrahams , Nick Dokos , emacs-orgmode@gnu.org On Mon, 27 Jun 2011 18:31:58 +0200, Bastien wrote: > Hi Pieter, > > Thanks for the patch at the end of this thread. > > Pieter Praet writes: > > > Ideally, we'd have a defcustom `org-crypt-auto-save' with the following options: > > - 'ask : Ask the user whether or not to decrypt the entry. > > - 'disable : Disable auto-save-mode for the current buffer before decrypting. > > - 'ignore : Decrypt the entry regardless. > > - 'encrypt : Re-encrypt the entries before auto-save kicks in. > > > > I've implemented this, but it fails miserably: > > > > Since the function `auto-save-mode' doesn't set an buffer-local > > var to indicate whether or not it's enabled for the current buffer, we > > can only check for `auto-save-default'. > > I think we should first ask emacs-devel to fix this, then implement your > clean solution. Would you like to report this problem? No need. It appears I'm a veritable moron, with apologies to the Emacs folks. 2 lessons I've learned today: - DON'T test this stuff in a *scratch* buffer (seriously...) - DO consume sufficient quantities of coffee (IOW, org-encrypt-entries doesn't encrypt entries unless they're *tagged* to be) > I'm not confident in disabling auto-save-mode globally by default, this > would surprise users -- even with a **BiG WaRnInG** message. No worries, it's buffer-local. And I've now changed the default to "ask first, shoot in the foot later". > What do you think? "I should send my patch" comes to mind :) Traffic allowing (lots of sweaty tourists on the road), it should be there in T-10sec. > -- > Bastien Peace -- Pieter From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pieter Praet Subject: [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable) Date: Tue, 28 Jun 2011 08:57:39 +0200 Message-ID: <1309244259-16494-1-git-send-email-pieter@praet.org> References: <87k4c6fnrh.fsf@praet.org> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbSFD-0002SM-KZ for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:58:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbSFB-0006pr-K7 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:57:59 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:44152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbSFB-0006pf-2s for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 02:57:57 -0400 Received: by wwf22 with SMTP id 22so4333066wwf.30 for ; Mon, 27 Jun 2011 23:57:56 -0700 (PDT) In-Reply-To: <87k4c6fnrh.fsf@praet.org> 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 Cc: Dave Abrahams , Bastien , Nick Dokos As auto-save-mode can only cause leakage when there's actual decrypted data lying around, don't check for it (and potentially cause annoyance) on init, but only when org-decrypt-entry is called. * lisp/org-crypt.el: - add defcustom `org-crypt-disable-auto-save' - `org-decrypt-entry': before decrypting, check whether `auto-save-mode' is enabled for the current buffer, and act on it according to how `org-crypt-disable-auto-save' is set. - remove comment re "encrypt[ing] Org auto-saved buffers" - remove on-init check for `auto-save-default' Signed-off-by: Pieter Praet --- lisp/org-crypt.el | 60 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 4bff7a1..1ff24b9 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -94,6 +94,29 @@ This setting can also be overridden in the CRYPTKEY property." :type 'string :group 'org-crypt) +(defcustom org-crypt-disable-auto-save 'ask + "What org-decrypt should do if `auto-save-mode' is enabled. + +t : Disable auto-save-mode for the current buffer + prior to decrypting an entry. + +nil : Leave auto-save-mode enabled. + This may cause data to be written to disk unencrypted! + +'ask : Ask user whether or not to disable auto-save-mode + for the current buffer. + +'encrypt : Leave auto-save-mode enabled for the current buffer, + but automatically re-encrypt all decrypted entries + *before* auto-saving. + NOTE: This only works for entries which have a tag + that matches `org-crypt-tag-matcher'." + :group 'org-crypt + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "Ask" ask) + (const :tag "Encrypt" encrypt))) + (defun org-crypt-key-for-heading () "Return the encryption key for the current heading." (save-excursion @@ -142,6 +165,30 @@ This setting can also be overridden in the CRYPTKEY property." (defun org-decrypt-entry () "Decrypt the content of the current headline." (interactive) + + ; auto-save-mode may cause leakage, so check whether it's enabled. + (when buffer-auto-save-file-name + (cond + ((or + (eq org-crypt-disable-auto-save t) + (and + (eq org-crypt-disable-auto-save 'ask) + (y-or-n-p "org-decrypt: auto-save-mode may cause leakage. Disable it for current buffer? "))) + (message (concat "org-decrypt: Disabling auto-save-mode for " (or (buffer-file-name) (current-buffer)))) + ; The argument to auto-save-mode has to be "-1", since + ; giving a "nil" argument toggles instead of disabling. + (auto-save-mode -1)) + ((eq org-crypt-disable-auto-save nil) + (message "org-decrypt: Decrypting entry with auto-save-mode enabled. This may cause leakage.")) + ((eq org-crypt-disable-auto-save 'encrypt) + (message "org-decrypt: Enabling re-encryption on auto-save.") + (add-hook 'auto-save-hook + (lambda () + (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.") + (org-encrypt-entries)) + nil t)) + (t nil))) + (require 'epg) (unless (org-before-first-heading-p) (save-excursion @@ -201,19 +248,6 @@ This setting can also be overridden in the CRYPTKEY property." 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) -;; FIXME Find a better way to encrypt Org auto-saved buffers? -;; When `auto-save-default' is non-nil, make sure entries are -;; encrypted before auto-saving -;; (when auto-save-default -;; (add-hook -;; 'org-mode-hook -;; (lambda () (add-hook 'auto-save-hook 'org-encrypt-entries nil t)))) - -(when (and (functionp 'daemonp) - (not (daemonp)) auto-save-default) - (message "Warning: turn auto-save-mode off in Org buffers containing crypted entries.") - (sit-for 1)) - (add-hook 'org-reveal-start-hook 'org-decrypt-entry) (provide 'org-crypt) -- 1.7.4.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable) Date: Tue, 28 Jun 2011 12:04:59 +0200 Message-ID: <87liwml19w.fsf@gnu.org> References: <87k4c6fnrh.fsf@praet.org> <1309244259-16494-1-git-send-email-pieter@praet.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbV9k-0000Rq-IO for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbV9i-0006bd-Fs for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:04:32 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:58574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbV9i-0006bY-1z for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:04:30 -0400 Received: by wwf22 with SMTP id 22so28586wwf.30 for ; Tue, 28 Jun 2011 03:04:29 -0700 (PDT) In-Reply-To: <1309244259-16494-1-git-send-email-pieter@praet.org> (Pieter Praet's message of "Tue, 28 Jun 2011 08:57:39 +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: Pieter Praet Cc: Dave Abrahams , Nick Dokos , emacs-orgmode@gnu.org Hi Pieter, Pieter Praet writes: > As auto-save-mode can only cause leakage when there's actual decrypted > data lying around, don't check for it (and potentially cause annoyance) > on init, but only when org-decrypt-entry is called. Applied, thanks for this! -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt Date: Tue, 28 Jun 2011 12:05:54 +0200 Message-ID: <87hb7al18d.fsf@gnu.org> References: <87hb7febzu.fsf@gnu.org> <1308949422-30288-1-git-send-email-pieter@praet.org> <11546.1308952204@alphaville.dokosmarshall.org> <8762ntjdwr.fsf@praet.org> <87pqlzutfl.fsf@gnu.org> <87k4c6fnrh.fsf@praet.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbVAd-0000k7-F2 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbVAb-0006kb-Uf for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:05:27 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:54561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbVAb-0006kV-KV for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 06:05:25 -0400 Received: by wwf22 with SMTP id 22so29190wwf.30 for ; Tue, 28 Jun 2011 03:05:24 -0700 (PDT) In-Reply-To: <87k4c6fnrh.fsf@praet.org> (Pieter Praet's message of "Tue, 28 Jun 2011 08:55:46 +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: Pieter Praet Cc: Dave Abrahams , Nick Dokos , emacs-orgmode@gnu.org Hi Pieter, Pieter Praet writes: > 2 lessons I've learned today: > - DON'T test this stuff in a *scratch* buffer (seriously...) > - DO consume sufficient quantities of coffee (IOW, org-encrypt-entries > doesn't encrypt entries unless they're *tagged* to be) :) >> I'm not confident in disabling auto-save-mode globally by default, this >> would surprise users -- even with a **BiG WaRnInG** message. > > No worries, it's buffer-local. > > And I've now changed the default to "ask first, shoot in the foot > later". This is good. Thanks! -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: Documentation suggestion re: buffers containing crypted entries Date: Tue, 28 Jun 2011 10:29:20 -0300 Message-ID: <4e09d735.6aaeec0a.7fbb.0831@mx.google.com> References: <4dbe281d.218fec0a.0399.ffffaafa@mx.google.com> <8762nv5yvf.fsf@ucl.ac.uk> <87hb7febzu.fsf@gnu.org> <878vsrxs4g.fsf@ucl.ac.uk> <87wrg7tdpl.fsf@altern.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbYM7-0002SL-LG for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 09:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbYM5-00027x-Rj for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 09:29:31 -0400 Received: from mail-gy0-f169.google.com ([209.85.160.169]:53139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbYM5-00027i-E4 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 09:29:29 -0400 Received: by gyg13 with SMTP id 13so104111gyg.0 for ; Tue, 28 Jun 2011 06:29:28 -0700 (PDT) In-Reply-To: <87wrg7tdpl.fsf@altern.org> 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: Bastien Cc: Dave Abrahams , emacs-orgmode@gnu.org I think we can disable auto-save locally using file variables, but what org-crypt seem to check is auto-save-default and its value probably won't change when auto-save is disabled locally. -- Darlan Cavalcante At Mon, 27 Jun 2011 18:56:54 +0200, Bastien wrote: > > Hi Eric, > > Eric S Fraga writes: > > > The question is where should this information be most appropriate to > > appear. In my view, this should be in the documentation (highlighted > > etc), not in the Emacs mini-buffer! I don't know enough texi (any at > > all, actually) so cannot suggest a patch. However, I would suggest that > > the warning that is in the code be moved into the entry for org-crypt.el > > in the info manual. > > I did so -- I added this to the config example in org.texi: > > ,---- > | (setq auto-save-default nil) > | ;; Auto-saving does not cooperate with org-crypt.el: so you need > | ;; to turn it off if you plan to use org-crypt.el quite often. > | ;; Otherwise, you'll get an (annoying) message each time you > | ;; start Org. > | > | ;; To turn it off only locally, you can insert this: > | ;; > | ;; # -*- buffer-auto-save-file-name: nil; -*- > `---- > > > Or, as originally proposed, the warning in the code > > could be wrapped in a customisable variable but this seems like overkill > > to me. > > To me too, unless we have a clean way to disable auto-save-mode locally. > > > Just my 2¢! > > 2thx! > > -- > Bastien >