bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#60105: [PATCH] Add yaml-ts-mode


From: Dmitry Gutov
Subject: bug#60105: [PATCH] Add yaml-ts-mode
Date: Thu, 5 Jan 2023 01:30:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 03/01/2023 20:21, Juri Linkov wrote:
The reason why I proposed a new customizable option is because
ruby-ts-mode provides an option ruby-ts-highlight-predefined-constants
that enables some rules in ruby-ts--font-lock-settings.  But maybe
there is no way to avoid this fine-grained setting in ruby-ts-mode.

But there is. What do you think about this change?

diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index 5c173ad24c7..93039c27511 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -87,11 +87,6 @@ ruby-ts
   :prefix "ruby-ts-"
   :group 'languages)

-(defcustom ruby-ts-highlight-predefined-constants t
-  "When non-nil, the pre-defined constants are highlighted.
-They will be highlighted the same way as the pre-defined variables."
-  :type 'boolean)
-
 (defvar ruby-ts--operators
   '("+" "-" "*" "/" "%" "**"
     "==" "!=" ">" "<" ">=" "<=" "<=>" "==="
@@ -202,9 +197,11 @@ ruby-ts--font-lock-settings

    :language language
    :feature 'builtin
- `(((global_variable) @var (:match ,ruby-ts--predefined-variables @var)) @font-lock-builtin-face
-     ,@(when ruby-ts-highlight-predefined-constants
- `(((constant) @var (:match ,ruby-ts--predefined-constants @var)) @font-lock-builtin-face))) + `(((global_variable) @var (:match ,ruby-ts--predefined-variables @var)) @font-lock-builtin-face)
+
+   :language language
+   :feature 'builtin-constant
+ `(((constant) @var (:match ,ruby-ts--predefined-constants @var)) @font-lock-builtin-face)

    :language language
    :feature 'keyword
@@ -932,7 +929,7 @@ ruby-ts-mode
   (setq-local treesit-font-lock-feature-list
               '(( comment method-definition )
                 ( keyword regexp string type)
-                ( builtin constant
+                ( builtin builtin-constant constant
                   delimiter escape-sequence global
                   instance
                   interpolation literal symbol variable)






reply via email to

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