[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: alter all subtrees containing specific tag
From: |
news |
Subject: |
[Orgmode] Re: alter all subtrees containing specific tag |
Date: |
Mon, 09 Mar 2009 12:28:20 +0000 |
<address@hidden> writes:
>
> Just discovered a bug in my previously posted function. It doesn't work
> too well if you have lower level subtrees tagged for encryption.
I also forgot to mention that you need to have pgg pre-loaded.
This will ensure that:
(defun my-func-org-toggle-encryption (rcpts passphrase)
(interactive (list (split-string (read-string "Recipients (default is none):
") "[ \t,]+")
(pgg-read-passphrase "GnuPG passphrase: ")))
(require 'pgg)
(show-all)
(org-map-entries '(let (start end teststring)
(org-outline-level)
(next-line)
(org-beginning-of-line)
(setq start (point))
(setq teststring (buffer-substring start (+ start 27)))
(outline-get-next-sibling)
(if (not (equal (point) (point-max)))
(previous-line))
(org-end-of-line)
(setq end (point))
(if (equal teststring "-----BEGIN PGP MESSAGE-----")
(if (pgg-decrypt-region start end passphrase)
(pgg-display-output-buffer start end t)
(message "Can't decrypt region!"))
(if (equal rcpts '(""))
(pgg-encrypt-symmetric-region start end passphrase)
(pgg-encrypt-region start end rcpts nil passphrase))
(pgg-display-output-buffer start end t)))
"+ENCRYPT"))
--
aleblanc