emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* disable "org-decrypt: auto-save-mode may cause leakage"
@ 2011-07-14 12:22 Karl Voit
  2011-07-14 13:14 ` Pieter Praet
  2011-07-14 13:17 ` Juan Pechiar
  0 siblings, 2 replies; 18+ messages in thread
From: Karl Voit @ 2011-07-14 12:22 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

How can I auto-answer the question from the subject line with «n»
(per default) any time it is asked?

Background story:

I am using org-decrypt on two files and I've got additional files
where I do not use any encryption at all.

But when I start my Emacs with my five most used org-files (which do
not use encryption), I have to answer five times the question
mentioned in the subject line above using «n» as answer.

I've already found the comment on the bottom of [1] and the
discussion of [2].

I *do* have deactivated auto-save by using the method explained in
[3] for my Org-files where I am using encryption. So I am save here
I guess.

But what I want to get rid of is this unnecessary question. I do not
want to be asked and have to answer with «no» because where it
matters, I already deactivated auto-save. So auto-save should be
«on» per default.

How can I accomplish this behavior?

And: shouldn't this be appended to [1]?

  1. http://orgmode.org/worg/org-tutorials/encrypting-files.html
  2. http://permalink.gmane.org/gmane.emacs.orgmode/43262
  3. http://anirudhs.chaosnet.org/blog/2005.01.21.html
-- 
Karl Voit

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 12:22 disable "org-decrypt: auto-save-mode may cause leakage" Karl Voit
@ 2011-07-14 13:14 ` Pieter Praet
  2011-07-14 13:17 ` Juan Pechiar
  1 sibling, 0 replies; 18+ messages in thread
From: Pieter Praet @ 2011-07-14 13:14 UTC (permalink / raw)
  To: news1142, emacs-orgmode

On Thu, 14 Jul 2011 14:22:32 +0200, Karl Voit <devnull@Karl-Voit.at> wrote:
> Hi!
> 
> How can I auto-answer the question from the subject line with «n»
> (per default) any time it is asked?
> 
> Background story:
> 
> I am using org-decrypt on two files and I've got additional files
> where I do not use any encryption at all.
> 
> But when I start my Emacs with my five most used org-files (which do
> not use encryption), I have to answer five times the question
> mentioned in the subject line above using «n» as answer.
> 
> I've already found the comment on the bottom of [1] and the
> discussion of [2].
> 
> I *do* have deactivated auto-save by using the method explained in
> [3] for my Org-files where I am using encryption. So I am save here
> I guess.
> 
> But what I want to get rid of is this unnecessary question. I do not
> want to be asked and have to answer with «no» because where it
> matters, I already deactivated auto-save. So auto-save should be
> «on» per default.
> 
> How can I accomplish this behavior?
> 
> And: shouldn't this be appended to [1]?
> 
>   1. http://orgmode.org/worg/org-tutorials/encrypting-files.html
>   2. http://permalink.gmane.org/gmane.emacs.orgmode/43262
>   3. http://anirudhs.chaosnet.org/blog/2005.01.21.html
> -- 
> Karl Voit
> 
> 

One only receives that prompt when running `org-decrypt-entry' in a buffer
where `buffer-auto-save-file-name' is non-nil (i.e. a buffer for which
`auto-save-mode' is enabled).

So, I assume you've configured Emacs to automatically run `org-decrypt-entries'
(which calls `org-decrypt-entry') whenever an org file is opened.

For more info, see the `org-crypt-disable-auto-save' variable (introduced in
commit 7bae2235) and this thread:
- http://comments.gmane.org/gmane.emacs.orgmode/41430


Peace

-- 
Pieter

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 12:22 disable "org-decrypt: auto-save-mode may cause leakage" Karl Voit
  2011-07-14 13:14 ` Pieter Praet
@ 2011-07-14 13:17 ` Juan Pechiar
  2011-07-14 13:37   ` Sebastien Vauban
  2011-07-14 15:14   ` Karl Voit
  1 sibling, 2 replies; 18+ messages in thread
From: Juan Pechiar @ 2011-07-14 13:17 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
> How can I auto-answer the question from the subject line with «n»
> (per default) any time it is asked?

Hi Karl,

You can customize this behaviour via

    org-crypt-disable-auto-save

You probably have it set to 'ask'. Options exist for always
enabling/disabling auto save, and for encrypting the auto-saved
version automatically.

M-x customize-variable RET org-crypt-disable-auto-save RET

Regards,
.j.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 13:17 ` Juan Pechiar
@ 2011-07-14 13:37   ` Sebastien Vauban
  2011-07-14 14:25     ` Pieter Praet
  2011-07-14 15:14   ` Karl Voit
  1 sibling, 1 reply; 18+ messages in thread
From: Sebastien Vauban @ 2011-07-14 13:37 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi all,

Juan Pechiar wrote:
> On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
>> How can I auto-answer the question from the subject line with «n»
>> (per default) any time it is asked?
>
> You can customize this behaviour via
>
>     org-crypt-disable-auto-save
>
> You probably have it set to 'ask'.

So did I. This is the default.

> Options exist for always enabling/disabling auto save, and for encrypting
> the auto-saved version automatically.
>
> M-x customize-variable RET org-crypt-disable-auto-save RET

Shouldn't its default value better be set to 'encrypt?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 13:37   ` Sebastien Vauban
@ 2011-07-14 14:25     ` Pieter Praet
  2011-07-14 14:42       ` Sebastien Vauban
  0 siblings, 1 reply; 18+ messages in thread
From: Pieter Praet @ 2011-07-14 14:25 UTC (permalink / raw)
  To: Sebastien Vauban, emacs-orgmode

On Thu, 14 Jul 2011 15:37:34 +0200, "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> wrote:
> Hi all,
> 
> Juan Pechiar wrote:
> > On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
> >> How can I auto-answer the question from the subject line with «n»
> >> (per default) any time it is asked?
> >
> > You can customize this behaviour via
> >
> >     org-crypt-disable-auto-save
> >
> > You probably have it set to 'ask'.
> 
> So did I. This is the default.
> 
> > Options exist for always enabling/disabling auto save, and for encrypting
> > the auto-saved version automatically.
> >
> > M-x customize-variable RET org-crypt-disable-auto-save RET
> 
> Shouldn't its default value better be set to 'encrypt?

I don't think so.

It only re-encrypts entries which are tagged :crypt: (or whatever you
have `org-crypt-tag-matcher' set to), so I'd prefer users to be "forced"
to at least read the docstring so as not to be using it with a false
sense of security.

Though this could be easily solved by automatically tagging entries upon
encryption, I think it's more "considerate" to simply (ask to) disable
`auto-save-mode' for the current buffer, as it's quite annoying to have
an entry get re-encrypted while you're in the middle of typing something.


> Best regards,
>   Seb
> 
> -- 
> Sebastien Vauban
> 
> 


Peace

-- 
Pieter

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 14:25     ` Pieter Praet
@ 2011-07-14 14:42       ` Sebastien Vauban
  2011-07-14 15:50         ` Pieter Praet
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastien Vauban @ 2011-07-14 14:42 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Pieter,

Pieter Praet wrote:
> On Thu, 14 Jul 2011 15:37:34 +0200, "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> wrote:
>> Juan Pechiar wrote:
>> > On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
>> >> How can I auto-answer the question from the subject line with «n»
>> >> (per default) any time it is asked?
>> >
>> > You can customize this behaviour via
>> >
>> >     org-crypt-disable-auto-save
>> >
>> > You probably have it set to 'ask'.
>> 
>> So did I. This is the default.
>> 
>> > Options exist for always enabling/disabling auto save, and for encrypting
>> > the auto-saved version automatically.
>> >
>> > M-x customize-variable RET org-crypt-disable-auto-save RET
>> 
>> Shouldn't its default value better be set to 'encrypt?
>
> I don't think so.
>
> It only re-encrypts entries which are tagged :crypt: (or whatever you
> have `org-crypt-tag-matcher' set to), so I'd prefer users to be "forced"
> to at least read the docstring so as not to be using it with a false
> sense of security.
>
> Though this could be easily solved by automatically tagging entries upon
> encryption, I think it's more "considerate" to simply (ask to) disable
> `auto-save-mode' for the current buffer, as it's quite annoying to have
> an entry get re-encrypted while you're in the middle of typing something.

This is more clear to me, and makes a lot of sense.

Though, what I find annoying, and the OP as well, is to be asked that question
for buffers which do not contain any encrypted entry. Would it be possible to
scan the buffer for such entries, and only ask the user when the buffer is
potentially exposed?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 13:17 ` Juan Pechiar
  2011-07-14 13:37   ` Sebastien Vauban
@ 2011-07-14 15:14   ` Karl Voit
  1 sibling, 0 replies; 18+ messages in thread
From: Karl Voit @ 2011-07-14 15:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

* Juan Pechiar <juan@pechiar.com> wrote:
> On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
>> How can I auto-answer the question from the subject line with «n»
>> (per default) any time it is asked?
>
> Hi Karl,
>
> You can customize this behaviour via
>     org-crypt-disable-auto-save
>
> You probably have it set to 'ask'. Options exist for always
> enabling/disabling auto save, and for encrypting the auto-saved
> version automatically.

You're right and it worked. Thanks!

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 14:42       ` Sebastien Vauban
@ 2011-07-14 15:50         ` Pieter Praet
  2011-07-18  9:24           ` Sebastien Vauban
  0 siblings, 1 reply; 18+ messages in thread
From: Pieter Praet @ 2011-07-14 15:50 UTC (permalink / raw)
  To: Sebastien Vauban, emacs-orgmode

On Thu, 14 Jul 2011 16:42:58 +0200, "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> wrote:
> Hi Pieter,
> 
> Pieter Praet wrote:
> > On Thu, 14 Jul 2011 15:37:34 +0200, "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> wrote:
> >> Juan Pechiar wrote:
> >> > On Thu, Jul 14, 2011 at 02:22:32PM +0200, Karl Voit wrote:
> >> >> How can I auto-answer the question from the subject line with «n»
> >> >> (per default) any time it is asked?
> >> >
> >> > You can customize this behaviour via
> >> >
> >> >     org-crypt-disable-auto-save
> >> >
> >> > You probably have it set to 'ask'.
> >> 
> >> So did I. This is the default.
> >> 
> >> > Options exist for always enabling/disabling auto save, and for encrypting
> >> > the auto-saved version automatically.
> >> >
> >> > M-x customize-variable RET org-crypt-disable-auto-save RET
> >> 
> >> Shouldn't its default value better be set to 'encrypt?
> >
> > I don't think so.
> >
> > It only re-encrypts entries which are tagged :crypt: (or whatever you
> > have `org-crypt-tag-matcher' set to), so I'd prefer users to be "forced"
> > to at least read the docstring so as not to be using it with a false
> > sense of security.
> >
> > Though this could be easily solved by automatically tagging entries upon
> > encryption, I think it's more "considerate" to simply (ask to) disable
> > `auto-save-mode' for the current buffer, as it's quite annoying to have
> > an entry get re-encrypted while you're in the middle of typing something.
> 
> This is more clear to me, and makes a lot of sense.
> 
> Though, what I find annoying, and the OP as well, is to be asked that question
> for buffers which do not contain any encrypted entry. Would it be possible to
> scan the buffer for such entries, and only ask the user when the buffer is
> potentially exposed?

AFAIK, that should already be the case.


Even when running with the following config...

  #+BEGIN_SRC emacs-lisp
    (add-hook 'find-file-hook 'org-decrypt-entries)
  #+END_SRC

... the user shouldn't get prompted needlessly, because `org-decrypt-entries'
applies `org-decrypt-entry' (which does the `auto-save-mode' check) *only*
to entries with a tag matching `org-crypt-tag-matcher' [1].

So prompting should only occur for buffers for which `auto-save-mode' is
enabled AND which contain one or more entries tagged with `crypt'
(regardless of whether the entry is actually encrypted, but that's
beside the point) UNLESS running `org-decrypt-entry' (auto-)manually for
each buffer.


I suspect it's a user config issue.

> Best regards,
>   Seb
> 
> -- 
> Sebastien Vauban
> 
> 


Peace

-- 
Pieter

[1] lisp/org-crypt.el:241

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-14 15:50         ` Pieter Praet
@ 2011-07-18  9:24           ` Sebastien Vauban
  2011-07-18 23:12             ` Bastien
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastien Vauban @ 2011-07-18  9:24 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Pieter,

Pieter Praet wrote:
> On Thu, 14 Jul 2011 16:42:58 +0200, "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> wrote:
>> Pieter Praet wrote:
>>> On Thu, 14 Jul 2011 15:37:34 +0200, "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> wrote:
>>>> Shouldn't its default value better be set to 'encrypt?
>>>
>>> I don't think so.
>>>
>>> It only re-encrypts entries which are tagged :crypt: (or whatever you
>>> have `org-crypt-tag-matcher' set to), so I'd prefer users to be "forced"
>>> to at least read the docstring so as not to be using it with a false
>>> sense of security.
>>>
>>> Though this could be easily solved by automatically tagging entries upon
>>> encryption, I think it's more "considerate" to simply (ask to) disable
>>> `auto-save-mode' for the current buffer, as it's quite annoying to have
>>> an entry get re-encrypted while you're in the middle of typing something.
>>
>> This is more clear to me, and makes a lot of sense.
>>
>> Though, what I find annoying, and the OP as well, is to be asked that
>> question for buffers which do not contain any encrypted entry. Would it be
>> possible to scan the buffer for such entries, and only ask the user when
>> the buffer is potentially exposed?
>
> AFAIK, that should already be the case.
>
> Even when running with the following config...
>
>   #+BEGIN_SRC emacs-lisp
>     (add-hook 'find-file-hook 'org-decrypt-entries)
>   #+END_SRC
>
> ... the user shouldn't get prompted needlessly, because
> `org-decrypt-entries' applies `org-decrypt-entry' (which does the
> `auto-save-mode' check) *only* to entries with a tag matching
> `org-crypt-tag-matcher' [1].
>
> So prompting should only occur for buffers for which `auto-save-mode' is
> enabled AND which contain one or more entries tagged with `crypt'
> (regardless of whether the entry is actually encrypted, but that's beside
> the point) UNLESS running `org-decrypt-entry' (auto-)manually for each
> buffer.
>
> I suspect it's a user config issue.

The "problem" I encounter is difficult to narrow, but I can tell you now that,
in my case, the question is asked for buffers which do not contain any tagged
entry with "crypt" (neither the string "crypt" as word or subword of that
buffer):

I simply call C-c C-x C-j to jump to the current clocking entry, and the
question "org-decrypt: auto-save-mode may cause leakage. Disable it for
current buffer? (y or n)" pops up -- while the current buffer has nothing
special, as said above.

This is reproducible for me, with Git version of this morning.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-18  9:24           ` Sebastien Vauban
@ 2011-07-18 23:12             ` Bastien
  2011-08-27 16:22               ` Pieter Praet
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2011-07-18 23:12 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

Hi Sébastien,

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> I simply call C-c C-x C-j to jump to the current clocking entry, and the
> question "org-decrypt: auto-save-mode may cause leakage. Disable it for
> current buffer? (y or n)" pops up -- while the current buffer has nothing
> special, as said above.

Weird.

Maybe you have some hook in `org-clock-goto-hook' that makes Org visit
some buffer containing encrypted entries?

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-07-18 23:12             ` Bastien
@ 2011-08-27 16:22               ` Pieter Praet
  2011-08-28  7:02                 ` Achim Gratz
  2011-08-29  9:09                 ` disable "org-decrypt: auto-save-mode may cause leakage" Sebastien Vauban
  0 siblings, 2 replies; 18+ messages in thread
From: Pieter Praet @ 2011-08-27 16:22 UTC (permalink / raw)
  To: Bastien, Sebastien Vauban, Carsten Dominik; +Cc: emacs-orgmode

On Tue, 19 Jul 2011 01:12:23 +0200, Bastien <bzg@altern.org> wrote:
> Hi Sébastien,
> 
> "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
> 
> > I simply call C-c C-x C-j to jump to the current clocking entry, and the
> > question "org-decrypt: auto-save-mode may cause leakage. Disable it for
> > current buffer? (y or n)" pops up -- while the current buffer has nothing
> > special, as said above.
>
> Weird.
> 
> Maybe you have some hook in `org-clock-goto-hook' that makes Org visit
> some buffer containing encrypted entries?

Apparently not config-related.

I don't use org-clock.el (and as such don't have any org-clock related
config, `org-clock-goto-hook' is nil), but due to a recent freak
accident involving spastic typing, I've managed to trigger the issue.
Apologies for dismissing it earlier, Sebastien.

`org-clock-goto' erroneously causes `org-decrypt-entry' to be called,
though it's not immediately obvious how or why this would happen.

Maybe Carsten (being listed as sole author for org-clock.el) can provide
some insight?

> -- 
>  Bastien
> 

Peace

-- 
Pieter

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-08-27 16:22               ` Pieter Praet
@ 2011-08-28  7:02                 ` Achim Gratz
  2011-08-28 11:35                   ` Pieter Praet
  2011-08-29  9:09                 ` disable "org-decrypt: auto-save-mode may cause leakage" Sebastien Vauban
  1 sibling, 1 reply; 18+ messages in thread
From: Achim Gratz @ 2011-08-28  7:02 UTC (permalink / raw)
  To: emacs-orgmode

Pieter Praet <pieter@praet.org> writes:
> Apparently not config-related.

So it does happen with just "emacs -Q"?  I cannot reproduce this.

Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-08-28  7:02                 ` Achim Gratz
@ 2011-08-28 11:35                   ` Pieter Praet
  2011-08-28 13:46                     ` [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry Pieter Praet
  0 siblings, 1 reply; 18+ messages in thread
From: Pieter Praet @ 2011-08-28 11:35 UTC (permalink / raw)
  To: Achim Gratz, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2301 bytes --]

On Sun, 28 Aug 2011 09:02:58 +0200, Achim Gratz <Stromeko@nexgo.de> wrote:
> Pieter Praet <pieter@praet.org> writes:
> > Apparently not config-related.
> 
> So it does happen with just "emacs -Q"?  I cannot reproduce this.

Well, not quite... :) Some minimal config is required.

1. Run EMACS like this:
   (don't forget to adjust the load-path)

   #+begin_src sh
     emacs -Q --eval="(progn
         (setq debug-on-error t)
         (add-to-list 'load-path \"~/src/org-mode/lisp\")
         (require 'org-install)
         (require 'org-crypt)
         (org-crypt-use-before-save-magic))"
   #+end_src

2. Open the ECM (in att) and complete the TODO's in sequence.


When running `org-clock-goto', the user will be prompted:
: org-decrypt: auto-save-mode may cause leakage. Disable it for current buffer? (y or n)
... which is rather uncalled for in this context.


I we'd be calling an error @ lisp/org-crypt.el::170, we'd get the following
backtrace upon running `org-clock-goto':

#+begin_example
  Debugger entered--Lisp error: (error "blah")
    signal(error ("blah"))
    error("blah")
    (progn (error "blah") (cond (... ... ...) (... ...) (... ... ...) (t nil)))
    (if buffer-auto-save-file-name (progn (error "blah") (cond ... ... ... ...)))
    (when buffer-auto-save-file-name (error "blah") (cond (... ... ...) (... ...) (... ... ...) (t nil)))
    org-decrypt-entry()
    run-hooks(org-reveal-start-hook)
    org-reveal()
    (let* ((recent nil) (m ...)) (org-pop-to-buffer-same-window (marker-buffer m)) (if (or ... ...) (widen)) (goto-char m) (org-show-entry) (org-back-to-heading t) (org-cycle-hide-drawers (quote children)) (recenter) (org-reveal) (if recent (message "No running clock, this is the most recently clocked task")) (run-hooks (quote org-clock-goto-hook)))
    org-clock-goto(nil)
    call-interactively(org-clock-goto nil nil)
#+end_example


So, either org-crypt shouldn't be imposing itself on `org-reveal-start-hook'
(see lisp/org-crypt.el::250) XOR `org-clock-goto' shouldn't call `org-reveal'.
I'll let others decide...


Peace


> Regards,
> Achim.
> -- 
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
> 
> Wavetables for the Waldorf Blofeld:
> http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
> 
> 

Peace

-- 
Pieter


[-- Attachment #2: crypt-vs-clock.org --]
[-- Type: text/plain, Size: 466 bytes --]

* NOTE here's an encrypted entry (symmetric, pass = "test")              :crypt:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (GNU/Linux)

jA0ECgMCBqqZSbotsitg0nwBKep+l0L85gNUFsipCPc6Nn/VKiRoZrbBU37f0+7w
yTBvfSXMpBKc+D8TZ4ZoIPwqNwc52TZA4phh5VQIs5T96PAXYH6yAQIBbG7ggMWV
4zrU6NiHU/dCCznsbObQXGkMg1tVU1Kp6A9EapGBklh24mcrwhG3BZQcqzN2
=uLcl
-----END PGP MESSAGE-----

* TODO run `org-clock-in' (`C-c C-x C-i') here

* TODO run `org-clock-goto' (`C-c C-x C-j') here

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry
  2011-08-28 11:35                   ` Pieter Praet
@ 2011-08-28 13:46                     ` Pieter Praet
  2011-10-08 16:11                       ` Carsten Dominik
  0 siblings, 1 reply; 18+ messages in thread
From: Pieter Praet @ 2011-08-28 13:46 UTC (permalink / raw)
  To: emacs-orgmode

* lisp/org-crypt.el (org-crypt-check-auto-save): New function, see next change.
* lisp/org-crypt.el (org-decrypt-entry): Break the auto-save-mode check out
  into a separate function, and call it at a later point, to assure it only
  runs when visiting an encrypted entry.

Currently `org-decrypt-entry' is doing the auto-save-mode check whenever
it's run, regardless of context, while this only makes sense when run on
an entry which is actually encrypted (or looks like it, at least).

Signed-off-by: Pieter Praet <pieter@praet.org>
---

 lisp/org-crypt.el |   54 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index 5991192..f764404 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -116,6 +116,35 @@ nil      : Leave auto-save-mode enabled.
                  (const :tag "Ask"     ask)
                  (const :tag "Encrypt" encrypt)))
 
+(defun org-crypt-check-auto-save ()
+  "Check whether auto-save-mode is enabled for the current buffer.
+
+`auto-save-mode' may cause leakage when decrypting entries, so
+check whether it's enabled, and decide what to do about it.
+
+See `org-crypt-disable-auto-save'."
+  (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))))
+
 (defun org-crypt-key-for-heading ()
   "Return the encryption key for the current heading."
   (save-excursion
@@ -164,30 +193,6 @@ nil      : Leave auto-save-mode enabled.
 (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
@@ -199,6 +204,7 @@ nil      : Leave auto-save-mode enabled.
 	       (outline-invisible-p))))
 	(forward-line)
 	(when (looking-at "-----BEGIN PGP MESSAGE-----")
+	  (org-crypt-check-auto-save)
 	  (let* ((end (save-excursion
 			(search-forward "-----END PGP MESSAGE-----")
 			(forward-line)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: disable "org-decrypt: auto-save-mode may cause leakage"
  2011-08-27 16:22               ` Pieter Praet
  2011-08-28  7:02                 ` Achim Gratz
@ 2011-08-29  9:09                 ` Sebastien Vauban
  1 sibling, 0 replies; 18+ messages in thread
From: Sebastien Vauban @ 2011-08-29  9:09 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Pieter,

Pieter Praet wrote:
> On Tue, 19 Jul 2011 01:12:23 +0200, Bastien <bzg-whniv8GeeGkdnm+yROfE0A@public.gmane.org> wrote:
>> "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> 
>> > I simply call C-c C-x C-j to jump to the current clocking entry, and the
>> > question "org-decrypt: auto-save-mode may cause leakage. Disable it for
>> > current buffer? (y or n)" pops up -- while the current buffer has nothing
>> > special, as said above.
>>
>> Weird.
>> 
>> Maybe you have some hook in `org-clock-goto-hook' that makes Org visit some
>> buffer containing encrypted entries?
>
> Apparently not config-related.
>
> I don't use org-clock.el (and as such don't have any org-clock related
> config, `org-clock-goto-hook' is nil), but due to a recent freak accident
> involving spastic typing, I've managed to trigger the issue. Apologies for
> dismissing it earlier, Sebastien.

No problem, Pieter. I did not expand the thread further by lack of time, and
-- at this point in time -- I can't prove yet whether you're wrong or right
(saying it could be config-related) in my case.

> `org-clock-goto' erroneously causes `org-decrypt-entry' to be called, though
> it's not immediately obvious how or why this would happen.

Your analysis and patch seems right to me, just from reading it.

However, in my case, I have the question coming up even when
org-clock-goto'ing to/from a buffer that does not contain any :crypt: entry!
But, as stated, by lack of time, I simply can't try to reduce the problem to
an ECM right now. So, I'll first test your patch, when pushed to the repo, and
report any new observation.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry
  2011-08-28 13:46                     ` [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry Pieter Praet
@ 2011-10-08 16:11                       ` Carsten Dominik
  2011-10-27  8:52                         ` Pieter Praet
  0 siblings, 1 reply; 18+ messages in thread
From: Carsten Dominik @ 2011-10-08 16:11 UTC (permalink / raw)
  To: Pieter Praet; +Cc: emacs-orgmode

Accepted, thanks.

- Carsten

On 28.8.2011, at 15:46, Pieter Praet wrote:

> * lisp/org-crypt.el (org-crypt-check-auto-save): New function, see next change.
> * lisp/org-crypt.el (org-decrypt-entry): Break the auto-save-mode check out
>  into a separate function, and call it at a later point, to assure it only
>  runs when visiting an encrypted entry.
> 
> Currently `org-decrypt-entry' is doing the auto-save-mode check whenever
> it's run, regardless of context, while this only makes sense when run on
> an entry which is actually encrypted (or looks like it, at least).
> 
> Signed-off-by: Pieter Praet <pieter@praet.org>
> ---
> 
> lisp/org-crypt.el |   54 +++++++++++++++++++++++++++++-----------------------
> 1 files changed, 30 insertions(+), 24 deletions(-)
> 
> diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
> index 5991192..f764404 100644
> --- a/lisp/org-crypt.el
> +++ b/lisp/org-crypt.el
> @@ -116,6 +116,35 @@ nil      : Leave auto-save-mode enabled.
>                  (const :tag "Ask"     ask)
>                  (const :tag "Encrypt" encrypt)))
> 
> +(defun org-crypt-check-auto-save ()
> +  "Check whether auto-save-mode is enabled for the current buffer.
> +
> +`auto-save-mode' may cause leakage when decrypting entries, so
> +check whether it's enabled, and decide what to do about it.
> +
> +See `org-crypt-disable-auto-save'."
> +  (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))))
> +
> (defun org-crypt-key-for-heading ()
>   "Return the encryption key for the current heading."
>   (save-excursion
> @@ -164,30 +193,6 @@ nil      : Leave auto-save-mode enabled.
> (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
> @@ -199,6 +204,7 @@ nil      : Leave auto-save-mode enabled.
> 	       (outline-invisible-p))))
> 	(forward-line)
> 	(when (looking-at "-----BEGIN PGP MESSAGE-----")
> +	  (org-crypt-check-auto-save)
> 	  (let* ((end (save-excursion
> 			(search-forward "-----END PGP MESSAGE-----")
> 			(forward-line)
> -- 
> 1.7.5.4
> 
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry
  2011-10-08 16:11                       ` Carsten Dominik
@ 2011-10-27  8:52                         ` Pieter Praet
  2011-10-28 15:13                           ` Bastien
  0 siblings, 1 reply; 18+ messages in thread
From: Pieter Praet @ 2011-10-27  8:52 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On Sat, 8 Oct 2011 18:11:32 +0200, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Accepted, thanks.

Thanks Carsten!


BTW, my FSF copyright assignment is completed (assignment number
#705083) so I should probably be added to the list of signees [1].
Would you like me to provide a patch to that effect?

> - Carsten
> 
> On 28.8.2011, at 15:46, Pieter Praet wrote:
> 
> > * lisp/org-crypt.el (org-crypt-check-auto-save): New function, see next change.
> > * lisp/org-crypt.el (org-decrypt-entry): Break the auto-save-mode check out
> >  into a separate function, and call it at a later point, to assure it only
> >  runs when visiting an encrypted entry.
> > 
> > Currently `org-decrypt-entry' is doing the auto-save-mode check whenever
> > it's run, regardless of context, while this only makes sense when run on
> > an entry which is actually encrypted (or looks like it, at least).
> > 
> > Signed-off-by: Pieter Praet <pieter@praet.org>
> > ---
> > 
> > lisp/org-crypt.el |   54 +++++++++++++++++++++++++++++-----------------------
> > 1 files changed, 30 insertions(+), 24 deletions(-)
> > 
> > diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
> > index 5991192..f764404 100644
> > --- a/lisp/org-crypt.el
> > +++ b/lisp/org-crypt.el
> > @@ -116,6 +116,35 @@ nil      : Leave auto-save-mode enabled.
> >                  (const :tag "Ask"     ask)
> >                  (const :tag "Encrypt" encrypt)))
> > 
> > +(defun org-crypt-check-auto-save ()
> > +  "Check whether auto-save-mode is enabled for the current buffer.
> > +
> > +`auto-save-mode' may cause leakage when decrypting entries, so
> > +check whether it's enabled, and decide what to do about it.
> > +
> > +See `org-crypt-disable-auto-save'."
> > +  (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))))
> > +
> > (defun org-crypt-key-for-heading ()
> >   "Return the encryption key for the current heading."
> >   (save-excursion
> > @@ -164,30 +193,6 @@ nil      : Leave auto-save-mode enabled.
> > (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
> > @@ -199,6 +204,7 @@ nil      : Leave auto-save-mode enabled.
> > 	       (outline-invisible-p))))
> > 	(forward-line)
> > 	(when (looking-at "-----BEGIN PGP MESSAGE-----")
> > +	  (org-crypt-check-auto-save)
> > 	  (let* ((end (save-excursion
> > 			(search-forward "-----END PGP MESSAGE-----")
> > 			(forward-line)
> > -- 
> > 1.7.5.4
> > 
> > 
> 

Peace


-- 
Pieter

[1] http://orgmode.org/worg/org-contribute.html#contributors_with_fsf_papers

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry
  2011-10-27  8:52                         ` Pieter Praet
@ 2011-10-28 15:13                           ` Bastien
  0 siblings, 0 replies; 18+ messages in thread
From: Bastien @ 2011-10-28 15:13 UTC (permalink / raw)
  To: Pieter Praet; +Cc: emacs-orgmode, Carsten Dominik

Hi Pieter,

Pieter Praet <pieter@praet.org> writes:

> BTW, my FSF copyright assignment is completed (assignment number
> #705083) so I should probably be added to the list of signees [1].

I just added you -- thanks for the reminder!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-10-28 15:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-14 12:22 disable "org-decrypt: auto-save-mode may cause leakage" Karl Voit
2011-07-14 13:14 ` Pieter Praet
2011-07-14 13:17 ` Juan Pechiar
2011-07-14 13:37   ` Sebastien Vauban
2011-07-14 14:25     ` Pieter Praet
2011-07-14 14:42       ` Sebastien Vauban
2011-07-14 15:50         ` Pieter Praet
2011-07-18  9:24           ` Sebastien Vauban
2011-07-18 23:12             ` Bastien
2011-08-27 16:22               ` Pieter Praet
2011-08-28  7:02                 ` Achim Gratz
2011-08-28 11:35                   ` Pieter Praet
2011-08-28 13:46                     ` [PATCH] org-crypt: when running org-decrypt-entry, only run auto-save-mode check if on an encrypted entry Pieter Praet
2011-10-08 16:11                       ` Carsten Dominik
2011-10-27  8:52                         ` Pieter Praet
2011-10-28 15:13                           ` Bastien
2011-08-29  9:09                 ` disable "org-decrypt: auto-save-mode may cause leakage" Sebastien Vauban
2011-07-14 15:14   ` Karl Voit

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).