From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pohlack Subject: Re: Backspacing into folded items Date: Fri, 03 Sep 2010 10:06:38 +0200 Message-ID: <4C80AC8E.8020002@os.inf.tu-dresden.de> References: <4C7598F2.7050200@os.inf.tu-dresden.de> <87iq2ny9rk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=40733 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrRIK-0005fI-6k for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 04:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrRII-0001Jn-Mg for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 04:06:43 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:45143) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrRII-0001JN-Hi for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 04:06:42 -0400 In-Reply-To: <87iq2ny9rk.fsf@gnu.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: David Abrahams , org-mode Hi Bastien On 03.09.2010 02:02, Bastien wrote: > Hi Martin, > > Martin Pohlack writes: > >> * You could add a modification hook to all hidden areas to unfold them >> on modification, or >> * You could set the read-only property for all hidden areas. This could >> be setup at the same location where hiding is done. > > I'm interested in testing both solutions, as I often delete hidden text > by accident as well. > > Can you give more details on how to set this up? These were just quick ideas, I have no working code here. Let me quickly draft something up: * If you want to go for the modification hook: You could do something very similar to what I did here: http://patchwork.newartisans.com/patch/31/ You would have to find all places again where the hidden property is set. There you would also add the modification hook. The hook would be the place to remove the hidden property again. You might have to have some policy in there, for example, to only uncover a single headline at a time etc. I am not sure if hidden areas are merged and at what granularity the property is set. Later, you might stumble upon code that tries to modify in hidden areas under the hood and you don't want all the text to be uncovered by such actions. You should then "bind inhibit-modification-hooks" in these functions. * If you want to go for the read-only property: You would have to find all places where the hidden property for regions is set or unset and also set or unset the read-only property there. In theory. There may exist code that wants to modify text blocks that are hidden. In this code, you would have to temporarily remove the read-only property (not sure if there is a way to override it). You may also get into trouble modifying text directly next to a read-only area because of stickiness (http://www.gnu.org/software/emacs/elisp/html_node/Sticky-Properties.html#Sticky-Properties). I just found this in the manual, not sure if this is a problem in practice. HTH, Martin