unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Basil Contovounesios <contovob@tcd.ie>, 64275@debbugs.gnu.org
Subject: bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
Date: Sun, 30 Jul 2023 09:53:15 +0200	[thread overview]
Message-ID: <87cz0995eq.fsf@gmail.com> (raw)
In-Reply-To: <68d19873-5c5f-894a-080f-b2e1bacc449a@gutov.dev>


Dmitry Gutov <dmitry@gutov.dev> writes:

> On 25/06/2023 12:00, Wilhelm Kirschbaum wrote:
>>         "~" @font-lock-string-face
>>         (sigil_name) @elixir-ts-font-sigil-name-face
>>         (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
>>        @font-lock-regexp-face
>> -     (sigil
>> -      "~" @font-lock-string-face
>> -      (sigil_name) @elixir-ts-font-sigil-name-face
>> -      quoted_start: _ @font-lock-string-face
>> -      quoted_end: _ @font-lock-string-face
>> -      (:match "^[HF]$" @elixir-ts-font-sigil-name-face)))
>> -
>> +     (sigil) @font-lock-string-face)
>
> Hi Wilhelm!
>
> Should we continue to use elixir-ts-font-sigil-name-face, 
> though?
>

Hi :)

We still need to match only the sigil_name part, so can't use the
@font-lock-string-face as it will exclude the '~', therefore we 
need a
custom font for the match.  This is only true for ~r/regex content 
here/ and
~R/regex content here/, or variance ~r(regex content here) 
etc. where
the font for the regex part is different than the font for the 
sigil
prefix.

Perhaps there is another way to both apply a font with
@font-lock-string-face and exclude it from the :match, but last 
time I
checked this was not possible.

> With the new patch, it will continue highlight the sigil name 
> ("r") in
> regexps, but no in other sigil types (s/c/w).
>

Incorrect, just below there is a:

           (sigil) @font-lock-string-face)

without a match, so they will be highlighted, but just more 
generically
as we don't know which sigils the user might have assigned.

> What's your opinion on that?

As a baseline it makes sense to me to apply font-lock-string-face 
to all
sigils, as they can be user defined.  Some are language core 
sigils,
like the ~r and ~R sigils and then there are common library 
accepted
sigils like ~H and ~F which can effectively be seen as part of the
language, these can be added over time as we improve this mode. 
The
initial ideas was to try and match a complete list, but won't 
work.
Users can also define sigils in their projects, so its better to 
rely on
the grammar to tell us its a sigil.

I ran the current patch for over a month and feels correct.

Wilhelm






  reply	other threads:[~2023-07-30  7:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-24 20:14 bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode Wilhelm Kirschbaum
2023-06-25  8:53 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25  9:00   ` Wilhelm Kirschbaum
2023-07-29 18:31     ` Wilhelm Kirschbaum
2023-07-30  2:06     ` Dmitry Gutov
2023-07-30  7:53       ` Wilhelm Kirschbaum [this message]
2023-07-30 12:09         ` Dmitry Gutov
2023-07-31  7:22           ` Wilhelm Kirschbaum
2023-08-01 11:59             ` Dmitry Gutov
2023-08-02  6:38               ` Wilhelm Kirschbaum
2023-08-16  2:11                 ` Dmitry Gutov
2023-10-07  8:46                   ` Wilhelm Kirschbaum
2023-10-07  9:59                     ` Wilhelm Kirschbaum
2023-10-07 10:10                       ` Wilhelm Kirschbaum
2023-10-21  7:39                         ` Wilhelm Kirschbaum
2023-10-26  0:27                           ` 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=87cz0995eq.fsf@gmail.com \
    --to=wkirschbaum@gmail.com \
    --cc=64275@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=dmitry@gutov.dev \
    /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).