From: Carsten Dominik <carsten.dominik@gmail.com>
To: Peter Jones <mlists@pmade.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [ANN] org-crypt version 0.2
Date: Thu, 2 Apr 2009 09:52:25 +0200 [thread overview]
Message-ID: <FCF0AA33-D8FA-4A02-A8A5-B2D2FB06D2BB@gmail.com> (raw)
In-Reply-To: <m28wmjlp2z.fsf@pmade.com>
[-- Attachment #1.1: Type: text/plain, Size: 2066 bytes --]
Hi Peter,
this looks really nice. I very much like the idea using a property
to set an encryption key.
On Apr 2, 2009, at 5:19 AM, Peter Jones wrote:
> Carsten: after encrypting a folded headline, the new contents of the
> heading won't be folded, but the headline will still appear to be
> folded. For example:
>
> * Before...
> * After...-------BEGIN PGP MESSAGE---------
> lkafjd;alkfjd;alfjd;ljf
> and so on....
>
> Please point me in the right direction for resolving this. Thank you.
Below is a patch which will fix this. Basically you need to
go back and fix the visibility of the entry, because you are
inserting in a location that confuses the invisibility code.
Instead of trying to get the insertion right, it is much better
to reset it for the entire tree.
The patch also does one other thing:
It makes encryption cover the entire subtree of an entry
with tag :crypt:, not just the text up to first child.
I believe this is more consistent with the structure or
Org-mode files. Would you agree?
- Carsten
--- org-crypt.el.orig 2009-04-02 08:35:24.000000000 +0200
+++ org-crypt.el 2009-04-02 08:46:59.000000000 +0200
@@ -101,12 +101,16 @@
(save-excursion
(org-back-to-heading t)
(forward-line)
- (let ((epg-context (epg-make-context nil t t))
+ (let ((folded (org-invisible-p))
+ (epg-context (epg-make-context nil t t))
(crypt-key (org-crypt-key-for-heading))
(beg (point))
end encrypted-text)
(when (and (not (looking-at "-----BEGIN PGP MESSAGE-----"))
- (or (outline-next-heading) (bolp)))
+ (progn
+ (org-end-of-subtree t t)
+ (org-back-over-empty-lines)
+ t))
(setq end (point)
encrypted-text
(epg-encrypt-string
@@ -115,6 +119,10 @@
(epg-list-keys epg-context crypt-key)))
(delete-region beg end)
(insert encrypted-text)
+ (when folded
+ (save-excursion
+ (org-back-to-heading t)
+ (hide-subtree)))
nil))))
(defun org-decrypt-entry ()
[-- Attachment #1.2: Type: text/html, Size: 4027 bytes --]
[-- Attachment #2: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2009-04-02 7:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 3:19 [ANN] org-crypt version 0.2 Peter Jones
2009-04-02 5:28 ` Carsten Dominik
2009-04-02 15:09 ` Peter Jones
2009-04-02 7:52 ` Carsten Dominik [this message]
2009-04-02 15:12 ` Peter Jones
2009-04-02 16:18 ` Carsten Dominik
2009-04-06 5:26 ` Carsten Dominik
2009-04-06 15:06 ` Peter Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FCF0AA33-D8FA-4A02-A8A5-B2D2FB06D2BB@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mlists@pmade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.