A little fix on my last patch: set the insertion type to t only for the end bound of the overlay as only this one should move on insertion
-- Sylvain 2014/1/15 Sylvain Chouleur <sylvain.choul...@gmail.com> > Hi all, > > here is a patch that fixes outline visibility saving. > > The root issue I've found is that when you call org-babel-execute-subtree > on a folded outline, the result is shown visible so the visibility property > is not well kept. > > The root cause is the markers used by org-outline-overlay-data to bound > the invisible area. > When org-babel-insert-result is called by org-babel-execute-subtree, text > is added from the position of marker that mark the end of invisible area. > As the insertion-type of the marker is by default nil, the marker stays > where it is but text is inserted after, so the inserted text becomes > visible. > > I'm not sure about the fix, I'm fearing some side effect I can't see in my > usage so it's open to any comments > > Thanks > > -- > Sylvain >
From a4bb85d9577e0454e01abe596f92b152007c0d9f Mon Sep 17 00:00:00 2001 From: Sylvain Chouleur <sylvain.choul...@intel.com> Date: Wed, 15 Jan 2014 00:38:55 +0100 Subject: [PATCH] Fix org-outline-overlay-data marker insertion-type * org.el: Set the insertion-type of bounds markers of org-outline-overlay-data to t (means marker advances when you insert text at it) This is to conserve outline visibility property when changes are made at the bounds of the data. For example: try org-babel-execute-subtree on a folded outline: The new result will be shown after the folded part of the outline whereas the outline body should not be visible. --- lisp/org.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index a53597e477e2..fc0f0ccb7125 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7191,8 +7191,12 @@ If USE-MARKERS is set, return the positions as markers." end (overlay-end o)) (and beg end (> end beg) (if use-markers - (cons (move-marker (make-marker) beg) - (move-marker (make-marker) end)) + (let ((bound + (cons (move-marker (make-marker) beg) + (move-marker (make-marker) end)))) + (set-marker-insertion-type (car bound) t) + (set-marker-insertion-type (cdr bound) t) + bound) (cons beg end))))) (overlays-in (point-min) (point-max)))))))) -- 1.8.5.2