Nathaniel Nicandro <nathanielnican...@gmail.com> writes: > The attached patch now uses `org-element-at-point' and > `org-element-context' to query for the bounds of elements.
Thanks! > Note, I've also attached an updated example file which shows that the > escape sequences in inline source blocks are now handled similarly to > regular source blocks, i.e. they are not fontified. I do not think that a single exception - source blocks is good enough. When having something like ANSI opening term is =<ANSI>=, and closing term is =<ANSI>= it will be not expected to get things fontified. A better approach will be: 1. Do not allow ANSI sequences to intersect markup boundaries of the same AST depth: *bold <ANSI>* plain text <ANSI> should not trigger fontification *bold <ANSI> /italic/ <ANSI>* should trigger plain text <ANSI> *bold* plain text <ANSI> also should 2. Disallow fontification is certain contexts - 'inline-src-block Further, your current code will do something weird when encountering greater element: :DRAWER: Paragraph <ANSI> Another paragraph <ANSI> :END: You should not consider greater elements when fontifying. > + (cl-letf (((symbol-function #'delete-region) > + (lambda (beg end) > + (add-text-properties beg end '(invisible t)))) This is fragile and relies on internal implementation details of ansi-color.el. Is there another way? -- 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>