From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: Re: alter all subtrees containing specific tag Date: Mon, 09 Mar 2009 12:28:20 +0000 Message-ID: <873admricb.fsf@it.com> References: <877i303a9w.fsf@it.com> <87hc23mno6.fsf@it.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lgeb0-0007Nu-M6 for emacs-orgmode@gnu.org; Mon, 09 Mar 2009 08:28:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lgeaz-0007L7-7r for emacs-orgmode@gnu.org; Mon, 09 Mar 2009 08:28:38 -0400 Received: from [199.232.76.173] (port=53405 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lgeaz-0007Kl-0b for emacs-orgmode@gnu.org; Mon, 09 Mar 2009 08:28:37 -0400 Received: from main.gmane.org ([80.91.229.2]:43076 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lgeay-0006ru-SJ for emacs-orgmode@gnu.org; Mon, 09 Mar 2009 08:28:37 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Lgear-00063F-4W for emacs-orgmode@gnu.org; Mon, 09 Mar 2009 12:28:29 +0000 Received: from 87-194-46-7.bethere.co.uk ([87.194.46.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Mar 2009 12:28:29 +0000 Received: from news by 87-194-46-7.bethere.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 09 Mar 2009 12:28:29 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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