emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] newlines and buffer corruption [was Re: [PATCH] org-capture: fix cap


From: Samuel Wales
Subject: [O] newlines and buffer corruption [was Re: [PATCH] org-capture: fix capture breaking next headline]
Date: Wed, 24 Oct 2018 16:53:21 -0700

whether it is an example of it i am not sure, but the case in the
org-capture thread is typical of a class of buffer corruption bugs
that is common in org.

if you have found similar corruption in your org files and wondered
why, this is probably the cause.  newlines that you didn't enter are
also related.

examples:

1 in capture i use hooks to fix whitespace.

2 in block editing, c-c ', you can get similar issues at the end of
the block.  [this example, however, might be a cultural influence of
the root cause and not a bug caused by the root cause.]

3 at one point long ago i reported a bug where sorting in a narrowed
region would corrupt the buffer.  this had gone unnoticed probably
because when you sort it is not obvious that the buffer was corrupted.

also there are similar things with org tree to indirect buffer.

===

when i looked into it a long time ago, the root cause was the design
of outline mode of which org was or is a derived mode.

at least one outline mode function acts as if an entry or subtree
starts before the first star and ends before -- yes, before -- the
final newline in the entry text contents.  frequent org coders
probably know this, but probably not everybody does.

people write workarounds to fix it, or they have no problem with it
and they code to it, or they aren't aware of it and don't account for
it.  for edge cases.  which they forget all about when the bug occurs.

then code gets called by other code, which means there are assumptions
sometimes broken, or workarounds that are necessary, and then there is
buffer corruption.

this touches on old debates.  it isn't just emacs.  look at crontab and wc.

i predict that more bugs [and user workarounds] will occur.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]