From: Dmitry Gutov <dmitry@gutov.dev>
To: JD Smith <jdtsmith@gmail.com>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: region-based face-remapping
Date: Sun, 7 Jan 2024 05:41:15 +0200 [thread overview]
Message-ID: <6ff6edea-5d4b-4eaa-ac0b-4c9e5fe3a4ff@gutov.dev> (raw)
In-Reply-To: <8B06B532-A445-43AE-883D-C9E5CF5DB870@gmail.com>
On 06/01/2024 15:53, JD Smith wrote:
> In the world of CSS, you’d do this quite simply by (say) updating the
> class of the div which wraps your text of interest, and having special
> styling for, e.g., "alternate bold" and "alternate italic”, which is
> only activated when the “alternate” class is applied:
>
> <div class=“normal”>
>
> This is <i>some italic text</i> and <b>some bold</b> text. This
> is unrelated text.
>
> </div>
>
>
> In CSS
>
> .alternate b {...}
> .alternate i {…}
>
> (In JS later:)
>
> myDiv.classList.add('alternate');
If we were to try to emulate CSS's nesting capability, perhaps we would
add some new attributes which would alter the existing ones (using
relative values). E.g. :background-relative and :foreground-relative,
which could be used to lighten or darken the colors provided by the
:background and :foreground attributes. The -relative ones could come
from a separate face, but the question would be how to make sure to
apply it - it would have to be the last rule in font-lock rules, to
avoid forcing all other rules to use :override. Or, I don't know, if
would need to be applied some other way at the end of font-lock. Main
thing, it wouldn't work off an overlay.
Or a different spin, for better theme-ability: some declarative forms
which allow to specify resulting attributes (colors, etc) for
combinations of faces. I.e. if two faces are present together, the
foreground and background should be this and that. The limitation is
also like the above.
But to be able to set these faces through an overlay, or even a text
property but without worrying about the application order vis-a-vis
font-lock, it would probably need to be a new property. Not sure if we'd
also need some new entities in its values, rather than regular faces.
Maybe the new property would specify one or several new values which
would correspond to new conditions in the DISPLAY form of face
definitions. But that would make defface forms incompatible with older
emacsen, I guess, and it's not certain whether it would be easy enough
to use for a third-party package author anyway.
next prev parent reply other threads:[~2024-01-07 3:41 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 0:22 region-based face-remapping JD Smith
2024-01-02 13:00 ` Eli Zaretskii
2024-01-02 15:49 ` JD Smith
2024-01-03 12:31 ` Eli Zaretskii
2024-01-03 12:40 ` Dmitry Gutov
2024-01-03 13:42 ` Eli Zaretskii
2024-01-04 0:07 ` Dmitry Gutov
2024-01-04 7:05 ` Eli Zaretskii
2024-01-05 3:49 ` Dmitry Gutov
2024-01-05 8:50 ` Eli Zaretskii
2024-01-05 14:18 ` Dmitry Gutov
2024-01-05 14:34 ` Eli Zaretskii
2024-01-05 16:25 ` Dmitry Gutov
2024-01-03 23:15 ` JD Smith
2024-01-04 6:58 ` Eli Zaretskii
2024-01-05 0:51 ` JD Smith
2024-01-05 8:19 ` Eli Zaretskii
2024-01-05 16:35 ` Dmitry Gutov
2024-01-06 14:04 ` JD Smith
2024-01-06 13:53 ` JD Smith
2024-01-06 14:27 ` Eli Zaretskii
2024-01-06 14:56 ` JD Smith
2024-01-08 17:28 ` Eli Zaretskii
2024-01-07 3:41 ` Dmitry Gutov [this message]
2024-01-15 19:55 ` Stefan Monnier via Emacs development discussions.
2024-01-15 20:19 ` Eli Zaretskii
2024-01-15 20:25 ` Eli Zaretskii
2024-01-15 20:36 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2024-01-08 21:49 JD Smith
2024-01-09 13:03 ` Eli Zaretskii
2024-01-09 14:15 ` Stefan Monnier
2024-01-09 20:20 ` JD Smith
2024-01-15 20:17 ` Stefan Monnier via Emacs development discussions.
2024-01-09 20:20 ` JD Smith
2024-01-10 12:36 ` Eli Zaretskii
2024-01-09 21:31 ` JD Smith
2024-01-10 12:44 ` Eli Zaretskii
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=6ff6edea-5d4b-4eaa-ac0b-4c9e5fe3a4ff@gutov.dev \
--to=dmitry@gutov.dev \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jdtsmith@gmail.com \
/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).