Subject: Re: bug#14157: 24.3.50; Improve facemenu.el: Better "integration" with other libraries

From: Eli Zaretskii <[email-masked]>
Date: Wed, 10 Apr 2013 19:49:20 +0300

> From: Jambunathan K <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 10 Apr 2013 21:59:11 +0530
> 
> When in an Org file, I want enriched mode to be turned on and the
> highlighted text to be persisted in the saved Org file.

Enriched mode is a means to an end.  But it's not the only means.

What you need is a way to tell Org to re-highlight some parts of the
text when the file is revisited.  How hard can that be?

> As I indicated the blocker is that facemenu.el doesn't play nicely with
> font-lock-modes.

No face plays nicely with font-lock-modes.

> Do you think that it is possible to achieve what users are requesting
> without using overlays?

Of course.

> As for Orgmode straining the display engine, it depends on many factors
> - I guess the size of the Orgmode file, number of foldings, number of
> overlays etc.

The problem is that a typical Org file has a lot of all of those.
Just moving vertically through a single display line might mean moving
hundreds of KBytes in the buffer.  The way Emacs display was designed,
this use case was not considered as an important one.

> I have seen prior discussions of using augmented interval trees for
> managing overlays.  (Theoretically) Will such a migration alleviate the
> problem/fear.

Being able to find overlays efficiently is only one part of the
problem.  The other one is that we have no easy way of finding which
parts of the buffer are "covered" by an overlay.  That forces many
dubious and expensive tricks during redisplay.