On 30.10.2011, at 02:07, Bastien wrote:

> Hi Suvayu,
> 
> suvayu ali <fatkasuvayu+li...@gmail.com> writes:
> 
>> Ah! Okay that seems reasonable, lets see what others think. :)
> 
> I've now pushed this commit so that more people can test it.

While I think that this is a potentially useful idea, 
I would like to point out a few things:

- This patch covers only one of many ways to make unwanted changes
  in an invisible area.  Others would be delete, backspace,
  kill-region, yank, kill-line, and an arbitrarily long list of
  less obvious other commands.  Full protection could only be
  done with pre-change-hooks or so, but would then prevent
  also programmed changes - something that would not be useful.
  `org-self-insert-command' is probably only ever used in an
  interactive way, so the patch as you have written it may very
  well function correctly.

- All the code in org-self-insert-command is executed for each
  keypress, so one needs to be careful to have this function
  carry as little overhead as possible.

- Currently this chokes at the beginning of the buffer because
  the invisibility test is also run at (1- (point)).

- I am not sure if I understand the positioning code:
> (if (or (eq invisible-before-point 'outline)
>       (eq invisible-before-point 'org-hide-block))
>     (goto-char (previous-overlay-change (point))))
> (org-cycle)
> (if (or (eq invisible-before-point 'outline)
>       (eq invisible-before-point 'org-hide-block))
>     (forward-char 1))

  So when I happen to be somewhere in the middle of invisible
  text and press a character, it seems to me that the character
  will be inserted at the beginning of the invisible text, and
  not where the cursor was.

  Maybe a better solution would be to save point, unfold,
  go back to point, throw and error and not insert the pressed
  character.  I am not sure, though.  Maybe you can explain
  your reasoning?

Regards

- Carsten


Reply via email to