0

I want to create overlay labels in text that appear at the start of a line, like so:

Selecting region to create overlay for

All is well

When selecting from the start of a newline, this looks good. But when I select the overlay's start to be from the middle of the line, I expectedly get the before-string text appearing in the middle of the line as well:

Bad inline BEFORE-STRING label

To circumvent this, I prefix the before-string with a newline character. Now, when I try to create an overlay from the middle of a line, I get:

Looks okay

However, now when I try to create an overlay from the start of the line, I get a superfluous visual newline:

Superfluous visual newline

I want to avoid this behavior by having the most pleasing visual appearance for this overlay.

I've tried to use overlay modification hooks, but that didn't end well because it is possible to delete from the start of the overlay to remove the preceding newline character, and the hook won't fire.

I must have the label outside of text (i.e. it must not be part of the "buffer"), and appear at the very beginning of the line. As far as I can tell right now, the only way to do this would be via buffer modification hooks, but I want to avoid that because I suspect it's going to be very slow when there's a high amount of overlays.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.