[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running o
From: |
Nick Dokos |
Subject: |
Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt |
Date: |
Fri, 24 Jun 2011 17:50:04 -0400 |
Pieter Praet <address@hidden> 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 <address@hidden>
> ---
> 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
>
>
- Re: [O] Documentation suggestion re: buffers containing crypted entries, Dave Abrahams, 2011/06/12
- Re: [O] Documentation suggestion re: buffers containing crypted entries, Eric S Fraga, 2011/06/24
- [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt, Pieter Praet, 2011/06/24
- Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt,
Nick Dokos <=
- Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt, Pieter Praet, 2011/06/26
- [O] [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable), Pieter Praet, 2011/06/26
- Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt, Bastien, 2011/06/27
- Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt, Pieter Praet, 2011/06/28
- [O] [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable), Pieter Praet, 2011/06/28
- Re: [O] [PATCH] org-crypt: make org-decrypt disable auto-save-mode (configurable), Bastien, 2011/06/28
- Re: [O] [PATCH] org-crypt: only warn about auto-save-mode when running org-decrypt, Bastien, 2011/06/28
Re: [O] Documentation suggestion re: buffers containing crypted entries, Bernt Hansen, 2011/06/24