emacs-orgmode
[Top][All Lists]
Advanced

[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:48:37 -0700


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))))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]