all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
@ 2024-04-19  2:01 Noah Peart
  2024-04-19  7:24 ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Noah Peart @ 2024-04-19  2:01 UTC (permalink / raw)
  To: 70465


[-- Attachment #1.1: Type: text/plain, Size: 929 bytes --]

Tags: patch


Adds a rule to font-lock Rust function signatures and missing function
modifier "default" to rust-ts-mode--keywords.

The new rule adds font-locking to signatures as in the following
example:

    trait Foo {
        fn foo() -> String;
//            ^ font-lock-function-name-face
    }


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2024-04-18 built on noah-X580VD
Repository revision: 0a57dfcff8d0abcf4427cfbfd886264bb3b8eaab
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.4 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'

[-- Attachment #1.2: Type: text/html, Size: 1080 bytes --]

[-- Attachment #2: 0001-Add-font-locking-rule-for-Rust-function-signatures.patch --]
[-- Type: text/x-patch, Size: 1634 bytes --]

From 1cce696ed89abe9fc3be5ea77b83c38e55c8a714 Mon Sep 17 00:00:00 2001
From: Noah Peart <noah.v.peart@gmail.com>
Date: Thu, 18 Apr 2024 18:52:06 -0700
Subject: [PATCH] Add font-locking rule for Rust function signatures

* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--font-lock-settings): Add font-lock rule for Rust
function signatures and missing function modifier keyword 'default'.
---
 lisp/progmodes/rust-ts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 7112ceced57..92978db64af 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -129,7 +129,7 @@ rust-ts-mode--builtin-macros
   "Rust built-in macros for tree-sitter font-locking.")
 
 (defvar rust-ts-mode--keywords
-  '("as" "async" "await" "break" "const" "continue" "dyn" "else"
+  '("as" "async" "await" "break" "const" "continue" "default" "dyn" "else"
     "enum" "extern" "fn" "for" "if" "impl" "in" "let" "loop" "match"
     "mod" "move" "pub" "ref" "return" "static" "struct" "trait" "type"
     "union" "unsafe" "use" "where" "while" (crate) (self) (super)
@@ -176,6 +176,7 @@ rust-ts-mode--font-lock-settings
    :language 'rust
    :feature 'definition
    '((function_item name: (identifier) @font-lock-function-name-face)
+     (function_signature_item name: (identifier) @font-lock-function-name-face)
      (macro_definition "macro_rules!" @font-lock-constant-face)
      (macro_definition (identifier) @font-lock-preprocessor-face)
      (field_declaration name: (field_identifier) @font-lock-property-name-face)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19  2:01 bug#70465: [PATCH] Add font-locking rule for Rust function signatures Noah Peart
@ 2024-04-19  7:24 ` Yuan Fu
  2024-04-19 10:47   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2024-04-19  7:24 UTC (permalink / raw)
  To: Noah Peart; +Cc: 70465


Noah Peart <noah.v.peart@gmail.com> writes:

> Tags: patch
>
> Adds a rule to font-lock Rust function signatures and missing function
> modifier "default" to rust-ts-mode--keywords.
>
> The new rule adds font-locking to signatures as in the following
> example:
>
>     trait Foo {
>         fn foo() -> String;
> //            ^ font-lock-function-name-face
>     }

Thanks!

Eli, for this kind of small fix patches, should it go to emacs-29 or
master? I don’t think it’ll affect the stability of emacs-29, but in the
same time it isn’t an urgent bug either.

Yuan





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19  7:24 ` Yuan Fu
@ 2024-04-19 10:47   ` Eli Zaretskii
  2024-04-19 16:47     ` Noah Peart
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-04-19 10:47 UTC (permalink / raw)
  To: Yuan Fu; +Cc: noah.v.peart, 70465

> Cc: 70465@debbugs.gnu.org
> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 19 Apr 2024 00:24:49 -0700
> 
> 
> Noah Peart <noah.v.peart@gmail.com> writes:
> 
> > Tags: patch
> >
> > Adds a rule to font-lock Rust function signatures and missing function
> > modifier "default" to rust-ts-mode--keywords.
> >
> > The new rule adds font-locking to signatures as in the following
> > example:
> >
> >     trait Foo {
> >         fn foo() -> String;
> > //            ^ font-lock-function-name-face
> >     }
> 
> Thanks!
> 
> Eli, for this kind of small fix patches, should it go to emacs-29 or
> master? I don’t think it’ll affect the stability of emacs-29, but in the
> same time it isn’t an urgent bug either.

Since this is an enhancement, not a bugfix, it should go to master.

Please be sure to add the bug number to the commit log message when
you install this.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19 10:47   ` Eli Zaretskii
@ 2024-04-19 16:47     ` Noah Peart
  2024-04-19 17:35       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Noah Peart @ 2024-04-19 16:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yuan Fu, 70465

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

> Please be sure to add the bug number to the commit log message when
you install this.

When submitting a patch, is there an easy way to add the bug number to
the commit?

On Fri, Apr 19, 2024 at 3:47 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > Cc: 70465@debbugs.gnu.org
> > From: Yuan Fu <casouri@gmail.com>
> > Date: Fri, 19 Apr 2024 00:24:49 -0700
> >
> >
> > Noah Peart <noah.v.peart@gmail.com> writes:
> >
> > > Tags: patch
> > >
> > > Adds a rule to font-lock Rust function signatures and missing function
> > > modifier "default" to rust-ts-mode--keywords.
> > >
> > > The new rule adds font-locking to signatures as in the following
> > > example:
> > >
> > >     trait Foo {
> > >         fn foo() -> String;
> > > //            ^ font-lock-function-name-face
> > >     }
> >
> > Thanks!
> >
> > Eli, for this kind of small fix patches, should it go to emacs-29 or
> > master? I don’t think it’ll affect the stability of emacs-29, but in the
> > same time it isn’t an urgent bug either.
>
> Since this is an enhancement, not a bugfix, it should go to master.
>
> Please be sure to add the bug number to the commit log message when
> you install this.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 1928 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19 16:47     ` Noah Peart
@ 2024-04-19 17:35       ` Eli Zaretskii
  2024-04-19 17:43         ` Noah Peart
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-04-19 17:35 UTC (permalink / raw)
  To: Noah Peart; +Cc: casouri, 70465

> From: Noah Peart <noah.v.peart@gmail.com>
> Date: Fri, 19 Apr 2024 09:47:38 -0700
> Cc: Yuan Fu <casouri@gmail.com>, 70465@debbugs.gnu.org
> 
> > Please be sure to add the bug number to the commit log message when
> you install this.
> 
> When submitting a patch, is there an easy way to add the bug number to
> the commit?

Only after you get the bug report back from the bug tracker.  When you
send the first message which creates a new bug report, you cannot know
it.  So we only ask people to add the bug number if they submit a
revised patch, because at that point the number is already known.
When an original patch is installed, the person who pushes it must do
a "git commit --amend" to edit the commit log message to add the bug
number.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19 17:35       ` Eli Zaretskii
@ 2024-04-19 17:43         ` Noah Peart
  2024-04-22  0:03           ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Noah Peart @ 2024-04-19 17:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 70465

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

Got it, thanks!

On Fri, Apr 19, 2024 at 10:35 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Noah Peart <noah.v.peart@gmail.com>
> > Date: Fri, 19 Apr 2024 09:47:38 -0700
> > Cc: Yuan Fu <casouri@gmail.com>, 70465@debbugs.gnu.org
> >
> > > Please be sure to add the bug number to the commit log message when
> > you install this.
> >
> > When submitting a patch, is there an easy way to add the bug number to
> > the commit?
>
> Only after you get the bug report back from the bug tracker.  When you
> send the first message which creates a new bug report, you cannot know
> it.  So we only ask people to add the bug number if they submit a
> revised patch, because at that point the number is already known.
> When an original patch is installed, the person who pushes it must do
> a "git commit --amend" to edit the commit log message to add the bug
> number.
>

[-- Attachment #2: Type: text/html, Size: 1423 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#70465: [PATCH] Add font-locking rule for Rust function signatures
  2024-04-19 17:43         ` Noah Peart
@ 2024-04-22  0:03           ` Yuan Fu
  0 siblings, 0 replies; 7+ messages in thread
From: Yuan Fu @ 2024-04-22  0:03 UTC (permalink / raw)
  To: Noah Peart; +Cc: 70465-done, Eli Zaretskii



> On Apr 19, 2024, at 10:43 AM, Noah Peart <noah.v.peart@gmail.com> wrote:
> 
> Got it, thanks!
> 
> On Fri, Apr 19, 2024 at 10:35 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Noah Peart <noah.v.peart@gmail.com>
> > Date: Fri, 19 Apr 2024 09:47:38 -0700
> > Cc: Yuan Fu <casouri@gmail.com>, 70465@debbugs.gnu.org
> > 
> > > Please be sure to add the bug number to the commit log message when
> > you install this.
> > 
> > When submitting a patch, is there an easy way to add the bug number to
> > the commit?
> 
> Only after you get the bug report back from the bug tracker.  When you
> send the first message which creates a new bug report, you cannot know
> it.  So we only ask people to add the bug number if they submit a
> revised patch, because at that point the number is already known.
> When an original patch is installed, the person who pushes it must do
> a "git commit --amend" to edit the commit log message to add the bug
> number.

And merged.

Yuan




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-22  0:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-19  2:01 bug#70465: [PATCH] Add font-locking rule for Rust function signatures Noah Peart
2024-04-19  7:24 ` Yuan Fu
2024-04-19 10:47   ` Eli Zaretskii
2024-04-19 16:47     ` Noah Peart
2024-04-19 17:35       ` Eli Zaretskii
2024-04-19 17:43         ` Noah Peart
2024-04-22  0:03           ` Yuan Fu

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.