Hello, I've gotten around to working on this again. Sorry for the long periods between updates. Ihor Radchenko writes: >> You want me to remove the code that is responsible for keeping the >> sequences visible according to `org-fold-show-set-visibility` and >> according to whether or not the sequence is currently being edited >> then? > >Yes. Done. > For now, let's default `org-ansi-hide-sequences' to nil. Done. With this patch, I have implemented the extend the font-lock region idea to account for editing around elements that have highlights which need to be maintained across edits, e.g. due to a split in a paragraph. The additional idea to the previous patch, other than the extend region stuff, is the packing of the `org-ansi-context` variable, essentially the same as the `ansi-color-context-region` variable, into an integer representation and storing it as the `org-ansi-context` text property (discussed in a previous email) of the highlighted regions. This is done to make that text property `eq` comparable for determining the extent of the highlight at point (`org-ansi-extent-of-context`). One other thing to note is that the ANSI sequences don't really play well with `flyspell-mode`. If you have something like [42mparagraph The end byte of the sequence, the 'm', causes flyspell to think the word is mparagraph instead of paragraph. Haven't looked into this at all yet. Wondering if anyone is more familiar with flyspell has an ideas as to a solution. Please review the patch and tell me what you think. I'm happy with the solution that I've come up with so far. There could be more tests for the extend region functionality, but I think its simple enough. I have extensive tests for the essential highlighting feature though, they could be a little cleaner though. There are not too many tests for the maintenance of highlighting across edits, developing unit tests for ensuring the highlights are proper after an edit is a little cumbersome given my understanding of font-lock. I wonder if there is any better approach.