Ihor Radchenko wrote:

JV <[email protected]> writes:

By adding font lock keywords for headline and plain list indicators
(e.g. stars, dashes, numbering) and indentation whitespace, we could
significantly improve variable pitch display in org-indent-mode.

org-indent-mode's alignment approach expects certain text elements to be
fixed pitch. When the 'default face is variable pitch, alignment can be
made to work perfectly well -- provided the structurally significant
elements at the beginning of lines are fontified as fixed pitch. This is
simple in principle; but some such syntax currently lacks font lock
keywords. In particular, the following are not presently given an
identifying face:

1. headline indicators (stars followed by space)

There is a keyword for that. The face is determined by `org-get-level-face'.

org-level-N faces are applied to both headline indicators (stars plus a
space) and their text. There isn't currently a way to fontify the
indicator (used by org-indent-mode for alignment) separately from the
headline text.

2. plain list item indicators (ordered or unordered marker followed by
     a space)

We have
;; Checkboxes
`(,org-list-full-item-re 3 'org-checkbox prepend lax)

Adding a face for bullet is trivial if desired.

3. spaces at beginning of line

Not sure why that would be needed.

When a plain list item contains multiple lines and/or paragraphs, some
lines will have structurally significant leading spaces (indicating
outline level) but no bullet or number. For these to align as intended,
the leading spaces, like other elements that give the list structure,
must be fixed pitch---even when buffer text is variable pitch. Assigning
a face to leading space permits this.

The first two of these would allow headline/list indicators to be
fontified additionally from their respective headline/list text.

There is something that does almost what you want: org-level-color-stars-only

Might it be reasonable to add faces and font lock keywords for these?

Having faces for headline and plain list indicators seems like a
generally useful addition even aside from the variable pitch use case.

I do not mind merging a patch that add extra faces for stars/item bullets.

If it sounds reasonable to you, I'd be happy to submit a patch that adds:

1. Faces for headline indicators, plain list indicators, and significant
leading spaces
2. Font lock keywords for each of these

The faces would not have any properties by default. They would simply
enable the formatting control mentioned above.

- Jeff





Reply via email to