[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning off colorization

From: Paul Rankin
Subject: Re: Turning off colorization
Date: Mon, 10 Nov 2014 11:41:03 +1000

On Mon, 10 Nov 2014, at 06:08 AM, Richard Stallman wrote:
>   > I develop a package that uses font-lock-mode extensively for
>   > coloured syntax highlighting but also line-prefix, wrap-prefix and
>   > invisible text properties. I also use font-lock-mode to manage a
>   > "element" text property that is integral to the mode.
> What job does the `element' property do?  Does it help set up the
> highlighting, or does it do some other job?
> If it does some other job, you want to have it done regardless of
> whether Font Lock mode is enabled. I think font lock has a hook for
> setting up such things, but I don't remember its name.

The text property (called `fountain-element') helps along fontification,
but it also helps along exporting to other formats, a la `htmlize'.
Actually the export engine I wrote was perhaps misguidedly based on
`htmlize'. The basic functionality is:

1. look at text block's `fountain-element' text property
2. check if `fountain-element' is correct
3. create exported element containing text formatted according to
   `fountain- element'

At the time I figured the `fountain-element' text property was a great
idea, but it is managed by `font-lock-mode', which is probably the wrong
way to do it. I'm currently looking at the parser in `org-element.el'
but it's a little overwhelming. If someone can recommend a good element
parser to study I would be very grateful :)

On Mon, 10 Nov 2014, at 08:03 AM, Stefan Monnier wrote:
> > Am I doing something wrong in using font-lock-mode to manage these
> > text properties? I tried to follow the docs to the letter.
> The way to decide is simple: font-lock-mode should be a cosmetic
> choice. The user should be able to turn it off and still get the same
> functionality, just with less visual effects (the user who turns off
> font-lock might call it "clutter" ;-).

Agreed, although my concern is more about non-coloured visual effects.
The mode makes extensive use of line-prefix and wrap-prefix to display
blocks of text indented according to syntax. The syntax, which I didn't
create, dictates indentation must remain cosmetic and not alter the file
contents (hence line-prefix and wrap- prefix a la `adaptive-wrap-mode').

So far so good. But if a regular user sees the option "colorize-mode"
and disables it, he or she will be surprised/confused to see cosmetic
indentation disappear also.

Did no one like my idea of utilising `font-lock-maximum-decoration'? I
feel like if an option called "Minimize Color" set this variable to 1
(either globally or for the current mode) and modes implemented multi-
level font lock keywords where 1 truly is the absolute minimum colour,
then this would be preferable. It seems like the control is already
there in font-lock, just that no one really uses it?

Paul W. Rankin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]