10

What I want is to be able to make a 'heading' under which I can have encrypted data. I should be able to have multiple headings within the same file in emacs.

I had this working, but unfortunately I don't remember what I needed to do in order to encrypt the data. For reference, this is what I had to add to my .emacs to get it working:

(require 'org-crypt)
(org-crypt-use-before-save-magic)
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
;; GPG key to use for encryption
;; Either the Key ID or set to nil to use symmetric encryption.
(setq org-crypt-key nil)

What I've tried so far: using :crypt: before my heading, running M-x org-encrypt-entry on the heading.

notablytipsy
  • 387
  • 1
  • 4
  • 19
  • Your problem is with the way you add tags : they should be put *after* the heading (try `C-c C-c` on the heading line to insert them). – Nikana Reklawyks Jan 05 '13 at 17:56
  • Yeah, I realized I was doing that wrong and changed it, but still nothing happens – notablytipsy Jan 05 '13 at 18:39
  • I'm sorry, but did you add space between `*` and `Heading` in your wrong string `*Heading :crypt:`? Also it doesn't have any spaces between beginning of line and `*`. Correct string has blue highlight, but wrong string is white. – artscan Jan 06 '13 at 12:11
  • Yep, it had blue highlight. I don't remember if I put the space. Unfortunately, my computer's gone for service, so I'll check it out once it comes back. – notablytipsy Jan 06 '13 at 19:48

1 Answers1

6

Your config of org-crypt is enough to get it working. I have the same one and all headings with tag :crypt: are encrypted before saving file (with different passfrases). Also, running M-x org-encrypt-entry manually encrypts current heading. Answer to your question can't be found with this description, it needed more details. For example: what happens if you running M-x org-encrypt-entry on heading? Org-crypt should ask passfrase and then replace text within heading. Or headings with tag :crypt: should be encrypted automatically before saving file.

EDIT: If current heading is syntactically correct (has blue highlight) and command M-x org-encrypt-entry produces error "Before first headline at position ... in buffer ..." then you can check value of variable outline-regexp (command C-h v outline-regexp). It may have incorrect value.

For me it is "\\*+ " in org-mode buffers.

artscan
  • 2,340
  • 15
  • 26
  • It doesn't ask for anything, just says `Before first headline at position 1 in buffer testgpg.org` – notablytipsy Dec 31 '12 at 18:33
  • I get same message `Before first ...` if cursor is on first line in file. Put cursor to heading: |* heading and run command again. – artscan Jan 01 '13 at 00:58
  • Nope, only the position number changes – notablytipsy Jan 01 '13 at 08:48
  • You have wrong behaviour of `org-mode` or wrong `* heading`, not `org-crypt`. If cursor is on `* heading`, you run command `org-encrypt-entry` and get this message `Before first headline at position ...`(which is generated by function `(org-back-to-heading t)`), then many functions of org-mode shouldn't work on same `* heading` too. For example, `M-x org-backward-heading-same-level` or `M-x org-insert-heading-after-current` shouldn't work. – artscan Jan 01 '13 at 09:31
  • My heading is `:crypt: *Heading` – notablytipsy Jan 01 '13 at 23:02
  • 2
    `org-mode`'s syntax for headings requires `* Heading :crypt:`. star(s) in the beggining of line, then space(s), name of heading, space(s), name(s) of tag(s). – artscan Jan 02 '13 at 01:10
  • Sorry for responding late; my computer had gone for service. This worked! Thanks! – notablytipsy Jan 17 '13 at 13:57