Eli Zaretskii <e...@gnu.org> writes: >> We may have a misunderstanding here. >> In "* Heading text :tag1:tag2:", everything is visible yet Org needs to >> protect ":tag1:tag2: from being killed by `kill-line', but not from >> `kill-whole-line'. Moreover, the behaviour also depends on the point >> position - if point is inside ":tag1:tag2:", we fall back to the default >> behaviour. And the whole "special" behaviour can also be switched off by >> flipping `org-special-ctrl-k'. >> >> Invisibility has nothing to do with this need. > > Isn't it true that invisibility is what causes the user expectations > in this case to begin with? Then saying that "invisibility has > nothing to do with this" is not really accurate, is it?
There are two things I raised in the previous messages: 1. The specific bug reported, related to invisibility changes in after-change-functions 2. A request to extend `kill-whole-line' and `kill-line' to cater Org needs: - for invisible text in folded headings - for visible text, when `kill-line' is called on a heading In this branch of the discussion, I am describing a request to deal with visible text. Hope I made things more clear now. >> >> What about something like `end-of-visible-line-function'? >> > >> > That is also a possibility, but it will then affect kill-line >> > _anywhere_ in the buffer, whereas a text property can have a more >> > localized effect. Are you sure kill-line will need this customization >> > on the whole buffer? >> >> Applying text property is not free - (1) we need to do it across the >> whole buffer, which scales poorly; (2) we need to keep it updated as the >> buffer changes, which scales even worse. In addition, adding more text >> properties slow down redisplay, which Org already strains to its limits. > > I understand, but in my book correctness tramps performance, and I was > trying to make the point that perhaps modifying the behavior of > kill-line everywhere in Org buffers might be incorrect for some cases. I think that `end-of-visible-line-function' might be more appropriate - it does not reduce correctness (we can simply fall back to the default behaviour when needed) and less problematic performance-wise, as I described. Or maybe some other idea. But not text properties - they are problematic performance-wise. In addition, `org-kill-line' is sensitive to point position (do different things at bol, before ":tag:...", and inside it). I am not sure how to make things depend on point position with text properties only. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>