emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <news@aleblanc.cotse.net>
To: emacs-orgmode@gnu.org
Subject: Re: alter all subtrees containing specific tag
Date: Mon, 09 Mar 2009 12:28:20 +0000	[thread overview]
Message-ID: <873admricb.fsf@it.com> (raw)
In-Reply-To: 87hc23mno6.fsf@it.com

<news@aleblanc.cotse.net> 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

  reply	other threads:[~2009-03-09 12:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-08  4:31 alter all subtrees containing specific tag news
2009-03-08 13:29 ` Carsten Dominik
2009-03-08 18:00   ` news
2009-03-09  0:56   ` news
2009-03-09  2:32   ` news
2009-03-09 12:28     ` news [this message]
2009-03-08 13:42 ` Ian Barton
2009-03-08 18:01   ` news

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873admricb.fsf@it.com \
    --to=news@aleblanc.cotse.net \
    --cc=emacs-orgmode@gnu.org \
    /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 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).