[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] deleting hidden parts of sparse trees
From: |
Carsten Dominik |
Subject: |
Re: [Orgmode] deleting hidden parts of sparse trees |
Date: |
Mon, 7 Jul 2008 09:44:16 -0700 |
On Jul 7, 2008, at 1:55 AM, Dan Davison wrote:
I'd like to be able to create a 'pruned' tree -- I am thinking of an
operation that is similar to sparse tree creation, but which results
in the deletion (not just folding) of all subtrees that contain no
matching entries.
I don't think this currently exists as such (?),
No, it does not.
but it is possible to do
what I want by (1) creating a sparse tree, and (2) org-export-visible,
selecting the 'keep-buffer' option.
That is a possibility, but for your task a much more direct way would be
to iterate directly over the overlays in the buffer and to delete text
accordingly.
(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.
HTH
- Carsten