emacs-devel
[Top][All Lists]
Advanced

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

Re: region-based face-remapping


From: Stefan Monnier
Subject: Re: region-based face-remapping
Date: Mon, 15 Jan 2024 14:55:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> To make this concrete, how would people approach the following:
>
> 1 On point motion, treesitter’s syntax tree is consulted to find an
>   "enclosing semantic context region".
> 2 Within that region, pre-existing faces (or perhaps other properties)
>   get updated to a “highlighted” variant.
> 3 Outdated/prior regions have the highlighted variants removed.
>
> Since you don’t know in advance how large such regions might be, it
> seems problematic to search and replace all the various faces or
> other properties.   

There' worse: you don't know in advance which faces can appear in the
region nor what those faces currently look like, so it's non-trivial to
find "highlighted variants".

Personally, I think the better way to the provide the above
functionality is by making faces more flexible.

A "face" specifies how to *modify* a "base appearance" w.r.t
various attributes.  In practice currently for most attributes the
modification is limited to one of two options:
- leave unchanged
- override

There are some exceptions, most importantly the size attribute which can
be a float to increase/reduce the base size.  I think such a third option
should be available for many other attributes, so we can have faces
which make the background color more red, or which increases/reduces
contrast, ...

[ I could also imagine a face which turns bolds into underlines (thus has
  an effect *across* attributes).  ]

With such a functionality, your request would be satisfied with a simple
overlay with a single `face` property.


        Stefan




reply via email to

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