From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: deleting hidden parts of sparse trees Date: Mon, 7 Jul 2008 09:48:37 -0700 Message-ID: References: <20080707085512.GA10608@stats.ox.ac.uk> <4D539FB1-44C6-4E19-B7A4-C147ED623C0A@uva.nl> Mime-Version: 1.0 (Apple Message framework v924) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KFttM-00088e-6w for emacs-orgmode@gnu.org; Mon, 07 Jul 2008 12:48:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KFttK-00086o-Dk for emacs-orgmode@gnu.org; Mon, 07 Jul 2008 12:48:43 -0400 Received: from [199.232.76.173] (port=42759 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KFttJ-00086H-On for emacs-orgmode@gnu.org; Mon, 07 Jul 2008 12:48:41 -0400 Received: from korteweg.uva.nl ([146.50.98.70]:58906) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KFttJ-0006XN-Dc for emacs-orgmode@gnu.org; Mon, 07 Jul 2008 12:48:41 -0400 In-Reply-To: <4D539FB1-44C6-4E19-B7A4-C147ED623C0A@uva.nl> 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: Carsten Dominik Cc: emacs org-mode mailing list On Jul 7, 2008, at 9:44 AM, Carsten Dominik wrote: > > (defun outline-delete-invisible () > "Delete all text covert by overlays with `invisible' property > `outline'." > (interactive) > (let ((ovls (overlays-in (point-min) (point-max))) o) > (while (setq o (pop ovls)) > (and (eq (overlay-get o 'invisible) 'outline)) > (delete-region (overlay-start o) (overlay-end o))))) > > > Do I need to mention that this will be a dangerous operation, deleting > lots of invisible text? You might find out only ater it is too late > to recover. Even much more dangerous then I thought, the command shown above actually deletes anything covered by overlays, not only outline overlays. Just one misplaced parenthesis...... Here is the corrected version. (defun outline-delete-invisible () "Delete all text covered by overlays with `invisible' property `outline'." (interactive) (let ((ovls (overlays-in (point-min) (point-max))) o) (while (setq o (pop ovls)) (and (eq (overlay-get o 'invisible) 'outline) (delete-region (overlay-start o) (overlay-end o))))))