unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Rankin <paul@tilk.co>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Richard Stallman <rms@gnu.org>, emacs-devel@gnu.org
Subject: Re: Turning off colorization
Date: Mon, 10 Nov 2014 11:41:03 +1000	[thread overview]
Message-ID: <1415583663.933454.188964801.345E55CB@webmail.messagingengine.com> (raw)
In-Reply-To: <jwvr3xcjart.fsf-monnier+emacs@gnu.org>

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
http://www.paulwrankin.com



      reply	other threads:[~2014-11-10  1:41 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 16:43 Turning off colorization Richard Stallman
2014-11-04 17:11 ` Phillip Lord
2014-11-05  4:57   ` Richard Stallman
2014-11-05  9:11     ` David Kastrup
2014-11-05 11:31       ` Ted Zlatanov
2014-11-05 11:51         ` Tassilo Horn
2014-11-05 12:49           ` Andreas Schwab
2014-11-05 13:05             ` Tassilo Horn
2014-11-05 11:52         ` Phillip Lord
2014-11-05 12:03           ` Ted Zlatanov
2014-11-05 12:30             ` Phillip Lord
2014-11-05 12:23         ` Lars Magne Ingebrigtsen
2014-11-05 12:52           ` Andreas Schwab
2014-11-05 17:06             ` Lars Magne Ingebrigtsen
2014-11-05 17:30               ` Eli Zaretskii
2014-11-05 17:35               ` Andreas Schwab
2014-11-05 19:56                 ` Lars Magne Ingebrigtsen
2014-11-05 20:17                   ` Eli Zaretskii
2014-11-05 12:55           ` Tassilo Horn
2014-11-05 13:00           ` Yoni Rabkin
2014-11-05 14:00           ` James Cloos
2014-11-05 18:13             ` Richard Stallman
2014-11-05 23:37               ` James Cloos
2014-11-06 10:05                 ` David Kastrup
2014-11-06 15:26                   ` Stefan Monnier
2014-11-06 16:03                     ` Alan Mackenzie
2014-11-06 16:53                       ` Stefan Monnier
2014-11-07  7:13                         ` Richard Stallman
2014-11-07 14:43                           ` Stefan Monnier
2014-11-08  6:44                             ` Richard Stallman
2014-11-08 15:26                               ` Stefan Monnier
2014-11-09 20:06                                 ` Richard Stallman
2014-11-07  7:12                     ` Richard Stallman
2014-11-05 15:02         ` Stefan Monnier
2014-11-06 20:13           ` N. Jackson
2014-11-06 21:42             ` Tim Cross
2014-11-06 23:14             ` Stefan Monnier
2014-11-07  0:10               ` Daniel Colascione
2014-11-07  4:13                 ` Stefan Monnier
2014-11-05 18:12       ` Richard Stallman
2014-11-05 11:05     ` Phillip Lord
2014-11-04 20:59 ` Nic Ferrier
     [not found]   ` <CAG-q9=a+nTM3KhYeBfzvSZOWKMjdDgaUyQw25_NkAkoad3QwOw@mail.gmail.com>
2014-11-05  1:09     ` Kelvin White
2014-11-05  2:10       ` Stephen J. Turnbull
2014-11-05  8:23         ` Harald Hanche-Olsen
2014-11-06 16:47 ` N. Jackson
2014-11-06 17:36   ` Eli Zaretskii
2014-11-06 19:55     ` N. Jackson
2014-11-06 18:00   ` Wolfgang Jenkner
2014-11-06 19:44     ` N. Jackson
2014-11-06 19:44   ` Tassilo Horn
2014-11-06 19:49     ` Eli Zaretskii
2014-11-07  6:36       ` Tassilo Horn
2014-11-07  7:06         ` Eli Zaretskii
2014-11-07  7:59           ` Tassilo Horn
2014-11-07  9:00             ` Eli Zaretskii
2014-11-06 21:55   ` Lars Magne Ingebrigtsen
2014-11-07  0:04   ` James Cloos
2014-11-07 13:57     ` Gregor Zattler
2014-11-07 14:02       ` Eli Zaretskii
2014-11-07 14:47         ` Gregor Zattler
2014-11-07 15:06           ` Eli Zaretskii
2014-11-07 15:27             ` Gregor Zattler
2014-11-07 16:59       ` James Cloos
2014-11-07 19:12         ` Mirek Kaim
2014-11-07 18:36       ` Andreas Schwab
2014-11-07  7:13   ` Richard Stallman
2014-11-07  8:43     ` Eli Zaretskii
2014-11-08  6:44       ` Richard Stallman
2014-11-08  8:15         ` Eli Zaretskii
2014-11-08 21:36           ` Richard Stallman
2014-11-08 22:18           ` James Cloos
2014-11-08 22:30             ` Lars Magne Ingebrigtsen
2014-11-08 22:51               ` James Cloos
2014-11-09  1:30                 ` Lars Magne Ingebrigtsen
2014-11-09  3:51                   ` Eli Zaretskii
2014-11-10 15:29                   ` Mirek Kaim
2014-11-10 16:21                     ` Eli Zaretskii
2014-11-10 18:37                       ` Mirek Kaim
2014-11-11  1:32                         ` Yuri Khan
2014-11-11 17:58                           ` Mirek Kaim
2014-11-09  3:45                 ` Eli Zaretskii
2014-11-09 14:57                   ` James Cloos
2014-11-09 16:26                     ` Eli Zaretskii
2014-11-09 20:07                   ` Richard Stallman
2014-11-09 20:13                     ` Eli Zaretskii
2014-11-10 19:07                       ` Richard Stallman
2014-11-10 19:57                         ` Eli Zaretskii
     [not found]     ` <<83r3xfs8mx.fsf@gnu.org>
2014-11-07 14:43       ` Drew Adams
2014-11-07 15:28         ` Stefan Monnier
2014-11-07 15:40           ` Eli Zaretskii
2014-11-07 16:08             ` Stefan Monnier
2014-11-08  6:44             ` Richard Stallman
2014-11-09  4:14 ` Paul W. Rankin
2014-11-09 20:08   ` Richard Stallman
2014-11-09 22:03   ` Stefan Monnier
2014-11-10  1:41     ` Paul Rankin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415583663.933454.188964801.345E55CB@webmail.messagingengine.com \
    --to=paul@tilk.co \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).