unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Randy Taylor <dev@rjt.dev>
Cc: Dmitry Gutov <dgutov@yandex.ru>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: font-lock-delimiter-face - what for?
Date: Thu, 29 Dec 2022 20:59:08 -0800	[thread overview]
Message-ID: <B293A742-085C-4030-A739-A310264DDB2E@gmail.com> (raw)
In-Reply-To: <TFFF985FTdVxT5IpIdu80ozK8zPkCnXEDABuxRqqtwzas-iVJHPhqJMC5rWkleJyTKYKqQ36xcBE9tb6BJWtgMrJRCQzhNEzIqL08nCRYQk=@rjt.dev>



> On Dec 29, 2022, at 10:41 AM, Randy Taylor <dev@rjt.dev> wrote:
> 
> On Thursday, December 29th, 2022 at 10:57, Dmitry Gutov <dgutov@yandex.ru> wrote:
>> 
>> On 29/12/2022 05:46, Randy Taylor wrote:
>> 
>>>>> Then we should get rid of font-lock-punctuation-face instead. If we keep it and use it in place of misc-punctuation, then changing punctuation-face would also change the bracket and delimiter faces, since they inherit from it.
>>>> 
>>>> That's usually how inheriting works, yes.
>>>> 
>>>> Do we anticipate misc-punctuation to often have unique attributes? If
>>>> so, it might be at least some reason to keep that face.
>>> 
>>> It depends on the language. A few modes already make use of it: bash-ts-mode, cmake-ts-mode, and yaml-ts-mode. We should also probably use it for string interpolation characters (e.g. { and }, or whatever the language uses).
>> 
>> 
>> They can use font-lock-punctuation-face in its place.
>> 
>>>>> font-lock-punctuation-face wouldn't be a great name either since it's no longer referring to all punctuation (which is its current goal, and the docstring can always be updated).
>>>> 
>>>> Why wouldn't it be referring to all punctuation? All attributes that are
>>>> not overridden by bracket- and delimiter- faces will show up in them.
>>> 
>>> That was assuming the bracket and delimiter faces would no longer be inheriting font-lock-punctuation-face. If they still are, and font-lock-punctuation-face is taking the place of font-lock-misc-punctuation-face, then changing that face also affects the bracket and delimiter faces too.
>> 
>> 
>> Yes.
>> 
>>> What if the user just wants misc. punctuation to be different?
>> 
>> 
>> Do they actually want that?
>> 
>> Suppose they do, though. If a user theme (user settings) or a named
>> theme changes some attribute in font-lock-punctuation-face which it
>> doesn't want to have in its descendants, they can go ahead and customize
>> the same attribute in descendants (all 2 of them) to have a different
>> value. Yes, that takes a little more effort.
>> 
>> Do we anticipate this to be the common case? If we have some evidence
>> toward that, then sure, having a separate face makes sense. And
>> font-lock-punctuation-face's docstring should mention that it's not to
>> be used directly.
> 
> I don't know about common but there's certainly a use case. I would say even more so for misc-punctuation than the others because special symbols can fall into that category.
> 
> To me it doesn't make sense to have font-lock-punctuation-face be inherited by bracket and delimiter and also be used for misc. punctuation purposes. Misc. punctuation is a distinctly separate category IMO (especially since it has a corresponding tree-sitter feature for syntax highlighting). I added font-lock-punctuation-face primarily to control all of the different kinds of punctuation (same as what the previous Emacs tree-sitter dynamic module did).

I tend to think of the inheritance in font-lock faces as a convenient placeholder more than actual inheritance. Ie, if a theme/user doesn’t bother to set separate values for every font-lock face, some faces simply use other face’s value. This is especially true for new font-lock faces, since themes and users don’t need to update their config.

Yuan


  reply	other threads:[~2022-12-30  4:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 15:44 font-lock-delimiter-face - what for? Dmitry Gutov
2022-12-27 16:44 ` Randy Taylor
2022-12-27 16:54   ` Dmitry Gutov
2022-12-27 18:20     ` Randy Taylor
2022-12-27 19:45       ` Dmitry Gutov
2022-12-27 21:01         ` Stefan Monnier
2022-12-27 21:34           ` Dmitry Gutov
2022-12-28 15:13             ` Dmitry Gutov
2022-12-28 17:06               ` Randy Taylor
2022-12-28 18:32                 ` Dmitry Gutov
2022-12-29  3:46                   ` Randy Taylor
2022-12-29 15:57                     ` Dmitry Gutov
2022-12-29 18:41                       ` Randy Taylor
2022-12-30  4:59                         ` Yuan Fu [this message]
2022-12-27 17:00 ` Eli Zaretskii
2022-12-27 19:46   ` Dmitry Gutov

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=B293A742-085C-4030-A739-A310264DDB2E@gmail.com \
    --to=casouri@gmail.com \
    --cc=dev@rjt.dev \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).