Hi Bastien, A few comments. I have also attached a small test file. On Sat, Oct 22, 2011 at 15:53, Bastien wrote: > > Here is a dummy patch that prevents the user from editing invisible > parts of the buffer.  It doesn't prevent query-and-replace commands. > > Can people test it and comment it? > > Maybe throwing an error is a bit too much.  Maybe preventing all > kind of edition in invisible parts of the buffer is too much as > well -- looking forward reading comments on this. > Using org-reveal might be better. I see that org-reveal works for lists but not for headlines or folded src_blocks (is that a regression?). If not, something with similar functionality for headlines and src_blocks would be great. Now about something more subtle and open to subjective opinion. In the example file, if you go to the beginning of a folded headline / list / src_block and hit C-e, this should take you to the end of the ellipsis. Now attempting to edit should either throw an error or unfold the item (depending on whether you have the patch as is or with my proposal). However if you press the cursor key to the right once after the C-e in the last step, then you end up after the ellipsis and inserting text is possible. The inserted text is placed right above the next entry. So in the attached test file, if you do this with the first headline the inserted text will be right before the second headline. In my opinion this means the problem would still exist. I don't understand overlays very well, but I was thinking if it could be resolved by adding a new line to the ellipsis. I customised org-ellipsis accordingly, although this didn't solve the problem it made it more obvious when I edited the folded entry inadvertently. I am not sure what would be an appropriate solution here. If there was a way to determine if you are inside a folded entity instead of testing for invisibility of `point' it might be better (maybe test if there is an overlayed ellipsis?). > Thanks, Hope these comments help. -- Suvayu Open source is the future. It sets us free.