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



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to