all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Randy Taylor <dev@rjt.dev>
To: Ergus <spacibba@aol.com>
Cc: 72228@debbugs.gnu.org
Subject: bug#72228: 31.0.50; Wrong number fontification in cmake-ts-mode
Date: Wed, 07 Aug 2024 01:00:01 +0000	[thread overview]
Message-ID: <lUk3ntEQPvJrFemqfMn3pw1fDNz3OkeI0wnEd4NiaBmTXfH3kDPBxe73F8bM31L6saZfVF1H2zbKd5UriA68lVumEtr-C3Wi7quPx3aSLaM=@rjt.dev> (raw)
In-Reply-To: <wax5jfQ3w8pPGcthD1Mqy77eKBueHIP4IXv3yv4sspegn91GK2cbmp_KOn7mb2w5MAUM_gOz17jBK9r_prxviMAyztz9-f4n4W2mQ33MHzU=@rjt.dev>

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

On Monday, July 22nd, 2024 at 22:32, Randy Taylor <dev@rjt.dev> wrote:
> 
> 
> On Sunday, July 21st, 2024 at 07:13, Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
> 
> > When using cmake-ts-mode the numbers have 3 different faces:
> > 
> > 1, 2, 100: font-lock-number-face (OK)
> > 
> > 0 : font-lock-constant-face. The cmake-ts-mode--constants takes
> > precedence over regex in font-lock-number-face. It is not clear that
> > this one can be fixed.
> 
> 
> 1 also gets font-lock-constant-face.
> 
> I think we should just remove "1" and "0" from cmake-ts-mode--constants.
> 
> > -1, -2 : Not fontified. This seems simpler to fix, the regex in
> > font-lock-number-face is missing a `-?' before the first [[:digit:]])
> 
> 
> Indeed. Would you like to submit a patch for that and the above?

I haven't heard anything back, so I've attached a patch doing so.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-cmake-ts-mode-number-fontification-Bug-72228.patch --]
[-- Type: text/x-patch; name=0001-Fix-cmake-ts-mode-number-fontification-Bug-72228.patch, Size: 1379 bytes --]

From 4a104bd11f56dcb0136b32852d14756e0f13c9d9 Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Tue, 6 Aug 2024 20:10:52 -0400
Subject: [PATCH] Fix cmake-ts-mode number fontification (Bug#72228)

* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--constants):
Remove "1" and "0".
(cmake-ts-mode--font-lock-settings): Match negative numbers.
---
 lisp/progmodes/cmake-ts-mode.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el
index b70806f4c30..854adf4ade7 100644
--- a/lisp/progmodes/cmake-ts-mode.el
+++ b/lisp/progmodes/cmake-ts-mode.el
@@ -73,8 +73,7 @@ cmake-ts-mode--indent-rules
   "Tree-sitter indent rules for `cmake-ts-mode'.")
 
 (defvar cmake-ts-mode--constants
-  '("1" "ON" "TRUE" "YES" "Y" "0" "OFF" "FALSE" "NO" "N" "IGNORE"
-    "NOTFOUND")
+  '("ON" "TRUE" "YES" "Y" "OFF" "FALSE" "NO" "N" "IGNORE" "NOTFOUND")
   "CMake constants for tree-sitter font-locking.")
 
 (defvar cmake-ts-mode--keywords
@@ -164,7 +163,7 @@ cmake-ts-mode--font-lock-settings
    :language 'cmake
    :feature 'number
    '(((unquoted_argument) @font-lock-number-face
-      (:match "\\`[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+\\'"
+      (:match "\\`-?[[:digit:]]*\\.?[[:digit:]]*\\.?[[:digit:]]+\\'"
               @font-lock-number-face)))
 
    :language 'cmake
-- 
2.46.0


  reply	other threads:[~2024-08-07  1:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <875xszm205.fsf.ref@aol.com>
2024-07-21 11:13 ` bug#72228: 31.0.50; Wrong number fontification in cmake-ts-mode Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-22  2:25   ` Randy Taylor
2024-07-23  2:32   ` Randy Taylor
2024-08-07  1:00     ` Randy Taylor [this message]
2024-08-07  8:45       ` Andrea Corallo
2024-08-07 13:14         ` Randy Taylor
2024-08-07 14:02           ` Andrea Corallo
2024-08-07 14:57             ` Randy Taylor
2024-08-07 15:38               ` Andrea Corallo
2024-08-07 15:52                 ` Randy Taylor

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

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

  git send-email \
    --in-reply-to='lUk3ntEQPvJrFemqfMn3pw1fDNz3OkeI0wnEd4NiaBmTXfH3kDPBxe73F8bM31L6saZfVF1H2zbKd5UriA68lVumEtr-C3Wi7quPx3aSLaM=@rjt.dev' \
    --to=dev@rjt.dev \
    --cc=72228@debbugs.gnu.org \
    --cc=spacibba@aol.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.