emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ANN] org-crypt version 0.2
@ 2009-04-02  3:19 Peter Jones
  2009-04-02  5:28 ` Carsten Dominik
  2009-04-02  7:52 ` Carsten Dominik
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Jones @ 2009-04-02  3:19 UTC (permalink / raw)
  To: emacs-orgmode

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

Attached is version 0.2 of John Wiegley's org-crypt.el.

Changes:

  - Headings to encrypt/decrypt are now selected with a tags matcher,
    which defaults to "crypt".  This means that all headings tagged
    "crypt" will be candidates for encryption/decryption.

  - The encryption key can be set via the `org-crypt-key' variable, or
    by setting the CRYPTKEY property.

  - The entire contents of a heading will be encrypted, including
    drawers.

  - New `org-decrypt-entries' function.

The org-crypt.el file contains some instructions, some customizable
variables, and a to-do list.

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.

Of course, feedback is welcome.  A HUGE thanks to Carsten and John.


[-- Attachment #2: org-crypt.el --]
[-- Type: application/emacs-lisp, Size: 5545 bytes --]

[-- Attachment #3: Type: text/plain, Size: 65 bytes --]


-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

[-- Attachment #4: 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

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

* Re: [ANN] org-crypt version 0.2
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2009-04-02  5:28 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode

Hi Peter,

I am a first time pgp/epg/epa user, so I need more guidance.

I have created a key with

    gpg --gen-key

Now when I do

  M-x epa-list-keys

I indeed see a line like

  u some-random-letters my name (comment) <email>

What exactly must I put into the variable or property for Org?

Thanks.

- Carsten


On Apr 2, 2009, at 5:19 AM, Peter Jones wrote:

> Attached is version 0.2 of John Wiegley's org-crypt.el.
>
> Changes:
>
>  - Headings to encrypt/decrypt are now selected with a tags matcher,
>    which defaults to "crypt".  This means that all headings tagged
>    "crypt" will be candidates for encryption/decryption.
>
>  - The encryption key can be set via the `org-crypt-key' variable, or
>    by setting the CRYPTKEY property.
>
>  - The entire contents of a heading will be encrypted, including
>    drawers.
>
>  - New `org-decrypt-entries' function.
>
> The org-crypt.el file contains some instructions, some customizable
> variables, and a to-do list.
>
> 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.
>
> Of course, feedback is welcome.  A HUGE thanks to Carsten and John.
>
> <org-crypt.el>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
> _______________________________________________
> 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

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

* Re: [ANN] org-crypt version 0.2
  2009-04-02  3:19 [ANN] org-crypt version 0.2 Peter Jones
  2009-04-02  5:28 ` Carsten Dominik
@ 2009-04-02  7:52 ` Carsten Dominik
  2009-04-02 15:12   ` Peter Jones
  1 sibling, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2009-04-02  7:52 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode


[-- 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

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

* Re: [ANN] org-crypt version 0.2
  2009-04-02  5:28 ` Carsten Dominik
@ 2009-04-02 15:09   ` Peter Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Jones @ 2009-04-02 15:09 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> I am a first time pgp/epg/epa user, so I need more guidance.
>
> I have created a key with
>
>    gpg --gen-key
>
> Now when I do
>
>  M-x epa-list-keys
>
> I indeed see a line like
>
>  u some-random-letters my name (comment) <email>
>
> What exactly must I put into the variable or property for Org?

Just about anything *should* work, an email address or a key ID.  I
always encrypt for myself, so I have this in my ~/.emacs:

,----
| (setq org-crypt-key "61C4F407C4EB56B7")
`----

I'll add some notes to org-crypt.el to make this more clear.

-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

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

* Re: [ANN] org-crypt version 0.2
  2009-04-02  7:52 ` Carsten Dominik
@ 2009-04-02 15:12   ` Peter Jones
  2009-04-02 16:18     ` Carsten Dominik
  2009-04-06  5:26     ` Carsten Dominik
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Jones @ 2009-04-02 15:12 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> 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.

Great, thanks!

> 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?

Yes, I had planned to do that, but wasn't sure exactly how.  You saved
me some time, thank you.

I have one other issue, if you want to point me in the right direction.
It seems that org-scan-tags will skip the first heading if that heading
is on the first line in the buffer.  If you add a blank line above the
heading, then org-scan-tags will pass it to the action function.

-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

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

* Re: Re: [ANN] org-crypt version 0.2
  2009-04-02 15:12   ` Peter Jones
@ 2009-04-02 16:18     ` Carsten Dominik
  2009-04-06  5:26     ` Carsten Dominik
  1 sibling, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2009-04-02 16:18 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode


On Apr 2, 2009, at 5:12 PM, Peter Jones wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> 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.
>
> Great, thanks!
>
>> 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?
>
> Yes, I had planned to do that, but wasn't sure exactly how.  You saved
> me some time, thank you.
>
> I have one other issue, if you want to point me in the right  
> direction.
> It seems that org-scan-tags will skip the first heading if that  
> heading
> is on the first line in the buffer.  If you add a blank line above the
> heading, then org-scan-tags will pass it to the action function.

It is funny, I *never* have a headline in line one.

Sometimes it is a hassle to handle this special case, but
in this case it is actually easy to fix.  ... It's done

I am looking forward to integrate org-crypt in 6.26.

- Carsten

>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
>
>
>
> _______________________________________________
> 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

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

* Re: Re: [ANN] org-crypt version 0.2
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2009-04-06  5:26 UTC (permalink / raw)
  To: Peter Jones; +Cc: emacs-orgmode

Hi Peter,

I did solve, I think, the issue with headlines in line one.

Should we go ahead and integrate org-crypt?

- Carsten

On Apr 2, 2009, at 5:12 PM, Peter Jones wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> 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.
>
> Great, thanks!
>
>> 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?
>
> Yes, I had planned to do that, but wasn't sure exactly how.  You saved
> me some time, thank you.
>
> I have one other issue, if you want to point me in the right  
> direction.
> It seems that org-scan-tags will skip the first heading if that  
> heading
> is on the first line in the buffer.  If you add a blank line above the
> heading, then org-scan-tags will pass it to the action function.
>
> -- 
> Peter Jones, http://pmade.com
> pmade inc.  Louisville, CO US
>
>
>
> _______________________________________________
> 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

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

* Re: [ANN] org-crypt version 0.2
  2009-04-06  5:26     ` Carsten Dominik
@ 2009-04-06 15:06       ` Peter Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Jones @ 2009-04-06 15:06 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> I did solve, I think, the issue with headlines in line one.
>
> Should we go ahead and integrate org-crypt?

I only had one more thing I wanted to do to it before the integration.
I think it should hook itself into before-save and the org-mode hooks to
automatically encrypt and decrypt the entries if org-crypt-automatically
is t.

Does that sound okay, or should that be the responsibility of the user?

-- 
Peter Jones, http://pmade.com
pmade inc.  Louisville, CO US

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

end of thread, other threads:[~2009-04-06 15:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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