emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Backspacing into folded items
@ 2010-08-25  9:22 David Abrahams
  2010-08-25 22:28 ` Martin Pohlack
  0 siblings, 1 reply; 12+ messages in thread
From: David Abrahams @ 2010-08-25  9:22 UTC (permalink / raw)
  To: emacs-orgmode


Hi All,

I've gotten myself in trouble several times today by backspacing after
an org-link that ends a headline.  That's a typical pattern for
editing an org-link, right?  Well it turns out that if the item is
folded, then the backspace writes over the end of the un-folded item
but **appears to have no effect**, and you can easily hit backspace
several times to test your sanity before you realize that something is
wrong, badly corrupting your file.

Seems to me that attempts to edit a folded item should either:

a) restrict changes to the item's headline, or
b) unfold the item and do nothing

Is there a way to set that up?

Thanks,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-08-25  9:22 Backspacing into folded items David Abrahams
@ 2010-08-25 22:28 ` Martin Pohlack
  2010-09-03  0:02   ` Bastien
  2010-09-03 13:40   ` Andreas Röhler
  0 siblings, 2 replies; 12+ messages in thread
From: Martin Pohlack @ 2010-08-25 22:28 UTC (permalink / raw)
  To: David Abrahams, org-mode

Hi David,

On 25.08.2010 11:22, David Abrahams wrote:
> I've gotten myself in trouble several times today by backspacing after
> an org-link that ends a headline.  That's a typical pattern for
> editing an org-link, right?  Well it turns out that if the item is
> folded, then the backspace writes over the end of the un-folded item
> but **appears to have no effect**, and you can easily hit backspace
> several times to test your sanity before you realize that something is
> wrong, badly corrupting your file.

I have had similar such accidents, but not involving links.  You
probably backspaced into the "..."?

> Seems to me that attempts to edit a folded item should either:
> 
> a) restrict changes to the item's headline, or
> b) unfold the item and do nothing
> 
> Is there a way to set that up?

Just two quick ideas from me here:
* 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.

See also here:
http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html#Special-Properties

I proposed a patch for image overlay which show a related problem here:
http://patchwork.newartisans.com/patch/31/

Cheers,
Martin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-08-25 22:28 ` Martin Pohlack
@ 2010-09-03  0:02   ` Bastien
  2010-09-03  8:06     ` Martin Pohlack
  2010-09-03 13:40   ` Andreas Röhler
  1 sibling, 1 reply; 12+ messages in thread
From: Bastien @ 2010-09-03  0:02 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: David Abrahams, org-mode

Hi Martin,

Martin Pohlack <mp26@os.inf.tu-dresden.de> 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?

This could also go to Worg.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-09-03  0:02   ` Bastien
@ 2010-09-03  8:06     ` Martin Pohlack
  2010-09-03 13:03       ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Martin Pohlack @ 2010-09-03  8:06 UTC (permalink / raw)
  To: Bastien; +Cc: David Abrahams, org-mode

Hi Bastien

On 03.09.2010 02:02, Bastien wrote:
> Hi Martin,
>
> Martin Pohlack<mp26@os.inf.tu-dresden.de>  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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-09-03  8:06     ` Martin Pohlack
@ 2010-09-03 13:03       ` Bastien
  0 siblings, 0 replies; 12+ messages in thread
From: Bastien @ 2010-09-03 13:03 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: David Abrahams, org-mode

Hi Martin,

Martin Pohlack <mp26@os.inf.tu-dresden.de> writes:

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

Thanks for the details.  I'll have a look at what solution best fits my
needs and report back.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-08-25 22:28 ` Martin Pohlack
  2010-09-03  0:02   ` Bastien
@ 2010-09-03 13:40   ` Andreas Röhler
  2010-09-03 14:13     ` [Orgmode] " Lennart Borgman
  1 sibling, 1 reply; 12+ messages in thread
From: Andreas Röhler @ 2010-09-03 13:40 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: David Abrahams, Martin Pohlack, Bastien, Emacs developers


Hi,

posting forwarded herewith describes a design inconvenience, wich 
affects common hide-show- and outline-modes too.

As too different solutions have been proposed, let me suggest
"setting read-only property" rather than "use of a modification hook".

Setting hidden text read-only should be more simple, straitforward - as 
presumably hiding some code had some reasons.

Editing hidden code is an error, which should be signaled rather than 
cured via hook.


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/


Am 26.08.2010 00:28, schrieb Martin Pohlack:
> Hi David,
>
> On 25.08.2010 11:22, David Abrahams wrote:
>> I've gotten myself in trouble several times today by backspacing after
>> an org-link that ends a headline.  That's a typical pattern for
>> editing an org-link, right?  Well it turns out that if the item is
>> folded, then the backspace writes over the end of the un-folded item
>> but **appears to have no effect**, and you can easily hit backspace
>> several times to test your sanity before you realize that something is
>> wrong, badly corrupting your file.
>
> I have had similar such accidents, but not involving links.  You
> probably backspaced into the "..."?
>
>> Seems to me that attempts to edit a folded item should either:
>>
>> a) restrict changes to the item's headline, or
>> b) unfold the item and do nothing
>>
>> Is there a way to set that up?
>
> Just two quick ideas from me here:
> * 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.
>
> See also here:
> http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html#Special-Properties
>
> I proposed a patch for image overlay which show a related problem here:
> http://patchwork.newartisans.com/patch/31/
>
> Cheers,
> Martin
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Orgmode] Backspacing into folded items
  2010-09-03 13:40   ` Andreas Röhler
@ 2010-09-03 14:13     ` Lennart Borgman
  2010-09-03 15:40       ` Andreas Röhler
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Lennart Borgman @ 2010-09-03 14:13 UTC (permalink / raw)
  To: Andreas Röhler
  Cc: David Abrahams, Emacs developers, Martin Pohlack, emacs-orgmode,
	Bastien

On Fri, Sep 3, 2010 at 3:40 PM, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
> Hi,
>
> posting forwarded herewith describes a design inconvenience, wich affects
> common hide-show- and outline-modes too.
>
> As too different solutions have been proposed, let me suggest
> "setting read-only property" rather than "use of a modification hook".
>
> Setting hidden text read-only should be more simple, straitforward - as
> presumably hiding some code had some reasons.


I recently filed a bug report about that hidden text in org-mode nodes
did not get visible when you start to edit them. It turned out I was
mistaken, I did not have reveal-mode on as I believed. However the
plan is to make reveal-mode default:

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6950

How would making the text read-only or add a modification hook
interact with the kind of problem reported in the bug above?


> Editing hidden code is an error, which should be signaled rather than cured
> via hook.
>
>
> Andreas
>
> --
> https://code.launchpad.net/~a-roehler/python-mode
> https://code.launchpad.net/s-x-emacs-werkstatt/
>
>
> Am 26.08.2010 00:28, schrieb Martin Pohlack:
>>
>> Hi David,
>>
>> On 25.08.2010 11:22, David Abrahams wrote:
>>>
>>> I've gotten myself in trouble several times today by backspacing after
>>> an org-link that ends a headline.  That's a typical pattern for
>>> editing an org-link, right?  Well it turns out that if the item is
>>> folded, then the backspace writes over the end of the un-folded item
>>> but **appears to have no effect**, and you can easily hit backspace
>>> several times to test your sanity before you realize that something is
>>> wrong, badly corrupting your file.
>>
>> I have had similar such accidents, but not involving links.  You
>> probably backspaced into the "..."?
>>
>>> Seems to me that attempts to edit a folded item should either:
>>>
>>> a) restrict changes to the item's headline, or
>>> b) unfold the item and do nothing
>>>
>>> Is there a way to set that up?
>>
>> Just two quick ideas from me here:
>> * 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.
>>
>> See also here:
>>
>> http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html#Special-Properties
>>
>> I proposed a patch for image overlay which show a related problem here:
>> http://patchwork.newartisans.com/patch/31/
>>
>> Cheers,
>> Martin
>>
>
>
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Orgmode] Backspacing into folded items
  2010-09-03 14:13     ` [Orgmode] " Lennart Borgman
@ 2010-09-03 15:40       ` Andreas Röhler
  2010-09-03 15:44       ` Samuel Wales
  2010-09-03 21:21       ` [Orgmode] " Stefan Monnier
  2 siblings, 0 replies; 12+ messages in thread
From: Andreas Röhler @ 2010-09-03 15:40 UTC (permalink / raw)
  To: Lennart Borgman
  Cc: David Abrahams, Emacs developers, Martin Pohlack, emacs-orgmode,
	Bastien

Hi Lennart,

IMHO cases are related but not identic.
When searching something and found inside hidden part, revealing that 
part is a logical step.

Not so with parts hidden while no interest inside.

For example these hidden parts may be large.

Revealing them every time you type into by mistake may turn out nasty.
Also you have to hide them again.

Using forms-mode, it happens quite often I reach a read-only field.
Forms-mode sets it `intangible' BTW, but thats similar.
Just get the error, know the mistake, not time spoiled for that.

Andreas


Am 03.09.2010 16:13, schrieb Lennart Borgman:
> On Fri, Sep 3, 2010 at 3:40 PM, Andreas Röhler
> <andreas.roehler@easy-emacs.de>  wrote:
>>
>> Hi,
>>
>> posting forwarded herewith describes a design inconvenience, wich affects
>> common hide-show- and outline-modes too.
>>
>> As too different solutions have been proposed, let me suggest
>> "setting read-only property" rather than "use of a modification hook".
>>
>> Setting hidden text read-only should be more simple, straitforward - as
>> presumably hiding some code had some reasons.
>
>
> I recently filed a bug report about that hidden text in org-mode nodes
> did not get visible when you start to edit them. It turned out I was
> mistaken, I did not have reveal-mode on as I believed. However the
> plan is to make reveal-mode default:
>
>    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6950
>
> How would making the text read-only or add a modification hook
> interact with the kind of problem reported in the bug above?
>
>
>> Editing hidden code is an error, which should be signaled rather than cured
>> via hook.
>>
>>
>> Andreas
>>
>> --
>> https://code.launchpad.net/~a-roehler/python-mode
>> https://code.launchpad.net/s-x-emacs-werkstatt/
>>
>>
>> Am 26.08.2010 00:28, schrieb Martin Pohlack:
>>>
>>> Hi David,
>>>
>>> On 25.08.2010 11:22, David Abrahams wrote:
>>>>
>>>> I've gotten myself in trouble several times today by backspacing after
>>>> an org-link that ends a headline.  That's a typical pattern for
>>>> editing an org-link, right?  Well it turns out that if the item is
>>>> folded, then the backspace writes over the end of the un-folded item
>>>> but **appears to have no effect**, and you can easily hit backspace
>>>> several times to test your sanity before you realize that something is
>>>> wrong, badly corrupting your file.
>>>
>>> I have had similar such accidents, but not involving links.  You
>>> probably backspaced into the "..."?
>>>
>>>> Seems to me that attempts to edit a folded item should either:
>>>>
>>>> a) restrict changes to the item's headline, or
>>>> b) unfold the item and do nothing
>>>>
>>>> Is there a way to set that up?
>>>
>>> Just two quick ideas from me here:
>>> * 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.
>>>
>>> See also here:
>>>
>>> http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html#Special-Properties
>>>
>>> I proposed a patch for image overlay which show a related problem here:
>>> http://patchwork.newartisans.com/patch/31/
>>>
>>> Cheers,
>>> Martin
>>>
>>
>>
>>
>>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Backspacing into folded items
  2010-09-03 14:13     ` [Orgmode] " Lennart Borgman
  2010-09-03 15:40       ` Andreas Röhler
@ 2010-09-03 15:44       ` Samuel Wales
  2010-09-03 21:21       ` [Orgmode] " Stefan Monnier
  2 siblings, 0 replies; 12+ messages in thread
From: Samuel Wales @ 2010-09-03 15:44 UTC (permalink / raw)
  To: Lennart Borgman
  Cc: Bastien, Martin Pohlack, Emacs developers, emacs-orgmode,
	David Abrahams

Dunno what is best, but when a solution is found, the following should
probably be tested to ensure that it is able to reverse the
non-editability:

  (let ((buffer-invisibility-spec))

On 2010-09-03, Lennart Borgman <lennart.borgman@gmail.com> wrote:
> On Fri, Sep 3, 2010 at 3:40 PM, Andreas Röhler
> <andreas.roehler@easy-emacs.de> wrote:
>>
>> Hi,
>>
>> posting forwarded herewith describes a design inconvenience, wich affects
>> common hide-show- and outline-modes too.
>>
>> As too different solutions have been proposed, let me suggest
>> "setting read-only property" rather than "use of a modification hook".
>>
>> Setting hidden text read-only should be more simple, straitforward - as
>> presumably hiding some code had some reasons.
>
>
> I recently filed a bug report about that hidden text in org-mode nodes
> did not get visible when you start to edit them. It turned out I was
> mistaken, I did not have reveal-mode on as I believed. However the
> plan is to make reveal-mode default:
>
>   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6950
>
> How would making the text read-only or add a modification hook
> interact with the kind of problem reported in the bug above?
>
>
>> Editing hidden code is an error, which should be signaled rather than
>> cured
>> via hook.
>>
>>
>> Andreas
>>
>> --
>> https://code.launchpad.net/~a-roehler/python-mode
>> https://code.launchpad.net/s-x-emacs-werkstatt/
>>
>>
>> Am 26.08.2010 00:28, schrieb Martin Pohlack:
>>>
>>> Hi David,
>>>
>>> On 25.08.2010 11:22, David Abrahams wrote:
>>>>
>>>> I've gotten myself in trouble several times today by backspacing after
>>>> an org-link that ends a headline.  That's a typical pattern for
>>>> editing an org-link, right?  Well it turns out that if the item is
>>>> folded, then the backspace writes over the end of the un-folded item
>>>> but **appears to have no effect**, and you can easily hit backspace
>>>> several times to test your sanity before you realize that something is
>>>> wrong, badly corrupting your file.
>>>
>>> I have had similar such accidents, but not involving links.  You
>>> probably backspaced into the "..."?
>>>
>>>> Seems to me that attempts to edit a folded item should either:
>>>>
>>>> a) restrict changes to the item's headline, or
>>>> b) unfold the item and do nothing
>>>>
>>>> Is there a way to set that up?
>>>
>>> Just two quick ideas from me here:
>>> * 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.
>>>
>>> See also here:
>>>
>>> http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html#Special-Properties
>>>
>>> I proposed a patch for image overlay which show a related problem here:
>>> http://patchwork.newartisans.com/patch/31/
>>>
>>> Cheers,
>>> Martin
>>>
>>
>>
>>
>>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>


-- 
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly serious
disease for 25 years]
==========
Retrovirus: http://www.wpinstitute.org/xmrv/index.html -- PLEASE DONATE
===
I would like to see the original Lo et al. 2010 NIH/FDA XMRV paper.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Orgmode] Backspacing into folded items
  2010-09-03 14:13     ` [Orgmode] " Lennart Borgman
  2010-09-03 15:40       ` Andreas Röhler
  2010-09-03 15:44       ` Samuel Wales
@ 2010-09-03 21:21       ` Stefan Monnier
  2010-09-03 21:31         ` Lennart Borgman
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2010-09-03 21:21 UTC (permalink / raw)
  To: Lennart Borgman
  Cc: Bastien, Martin Pohlack, Emacs developers, emacs-orgmode,
	David Abrahams, Andreas Röhler

> However the plan is to make reveal-mode default:

You're jumping to conclusions,


        Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Orgmode] Backspacing into folded items
  2010-09-03 21:21       ` [Orgmode] " Stefan Monnier
@ 2010-09-03 21:31         ` Lennart Borgman
  2010-09-04  8:42           ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Lennart Borgman @ 2010-09-03 21:31 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Bastien, Martin Pohlack, Emacs developers, emacs-orgmode,
	David Abrahams, Andreas Röhler

On Fri, Sep 3, 2010 at 11:21 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> However the plan is to make reveal-mode default:
>
> You're jumping to conclusions,

Sorry, but what is the plan then?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Orgmode] Backspacing into folded items
  2010-09-03 21:31         ` Lennart Borgman
@ 2010-09-04  8:42           ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2010-09-04  8:42 UTC (permalink / raw)
  To: Lennart Borgman
  Cc: Bastien, Martin Pohlack, Emacs developers, emacs-orgmode,
	David Abrahams, Andreas Röhler

>>> However the plan is to make reveal-mode default:
>> You're jumping to conclusions,
> Sorry, but what is the plan then?

W.r.t. reveal-mode, there is no plan.


        Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-09-04  8:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-25  9:22 Backspacing into folded items David Abrahams
2010-08-25 22:28 ` Martin Pohlack
2010-09-03  0:02   ` Bastien
2010-09-03  8:06     ` Martin Pohlack
2010-09-03 13:03       ` Bastien
2010-09-03 13:40   ` Andreas Röhler
2010-09-03 14:13     ` [Orgmode] " Lennart Borgman
2010-09-03 15:40       ` Andreas Röhler
2010-09-03 15:44       ` Samuel Wales
2010-09-03 21:21       ` [Orgmode] " Stefan Monnier
2010-09-03 21:31         ` Lennart Borgman
2010-09-04  8:42           ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).