unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* rust-ts-mode: appropriately fontify doc strings
@ 2023-11-29 23:21 Christophe TROESTLER
  2023-12-01  0:50 ` Dmitry Gutov
  0 siblings, 1 reply; 12+ messages in thread
From: Christophe TROESTLER @ 2023-11-29 23:21 UTC (permalink / raw)
  To: emacs-devel@gnu.org

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

Hi,

The attached patch for rust-ts-mode fontifies documentation comments with `font-lock-doc-face' instead of `font-lock-comment-face' (as it is the case right now).

Best regards,
Christophe


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rust-ts-mode: appropriately fontify doc strings.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-appropriately-fontify-doc-strings.patch", Size: 1705 bytes --]

From 81020267812e57a94982f2620241c1ad69a0fc1b Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Thu, 30 Nov 2023 00:13:10 +0100
Subject: [PATCH] rust-ts-mode: appropriately fontify doc strings
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..aef6b5cb91a 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -153,7 +153,7 @@ rust-ts-mode--font-lock-settings
 
    :language 'rust
    :feature 'comment
-   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+   '(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
 
    :language 'rust
    :feature 'delimiter
@@ -293,6 +293,16 @@ rust-ts-mode--font-lock-settings
    '((ERROR) @font-lock-warning-face))
   "Tree-sitter font-lock settings for `rust-ts-mode'.")
 
+(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
+  "Use the comment or documentation face appropriately for comments."
+  (let* ((beg (treesit-node-start node))
+         (end (treesit-node-end node))
+         (prefix (buffer-substring-no-properties beg (min (+ beg 3) end)))
+         (face (if (string-equal "///" prefix)
+                   'font-lock-doc-face
+                 'font-lock-comment-face)))
+    (treesit-fontify-with-override beg end face override start end)))
+
 (defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
   (let* ((case-fold-search nil)
          (face
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-11-29 23:21 rust-ts-mode: appropriately fontify doc strings Christophe TROESTLER
@ 2023-12-01  0:50 ` Dmitry Gutov
  2023-12-01  8:25   ` Christophe TROESTLER
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Gutov @ 2023-12-01  0:50 UTC (permalink / raw)
  To: Christophe TROESTLER, emacs-devel@gnu.org

On 30/11/2023 01:21, Christophe TROESTLER wrote:
> +         (prefix (buffer-substring-no-properties beg (min (+ beg 3) end)))
> +         (face (if (string-equal "///" prefix)

It'll probably be faster overall to use save-excursion and looking-at 
instead of creating a substring.



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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01  0:50 ` Dmitry Gutov
@ 2023-12-01  8:25   ` Christophe TROESTLER
  2023-12-01 21:38     ` Christophe TROESTLER
  2023-12-01 23:58     ` Dmitry Gutov
  0 siblings, 2 replies; 12+ messages in thread
From: Christophe TROESTLER @ 2023-12-01  8:25 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel@gnu.org

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

Hi,

On  1 December 2023 at 01:50 +01, Dmitry Gutov <dmitry@gutov.dev> wrote:
> On 30/11/2023 01:21, Christophe TROESTLER wrote:
>> +         (prefix (buffer-substring-no-properties beg (min (+ beg 3) end)))
>> +         (face (if (string-equal "///" prefix)
>
> It'll probably be faster overall to use save-excursion and looking-at
> instead of creating a substring.

Thanks for your feedback. I did dome tests and the two are comparable (on Emacs 29.1) but here is a version that uses your suggestion.

Best,
C.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-rust-ts-mode-appropriately-fontify-doc-strings.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-appropriately-fontify-doc-strings.patch", Size: 1695 bytes --]

From 535aea00825221494a1c67413e5e9b73bb7d7324 Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Thu, 30 Nov 2023 00:13:10 +0100
Subject: [PATCH] rust-ts-mode: appropriately fontify doc strings
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..03ff2776d3a 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -153,7 +153,7 @@ rust-ts-mode--font-lock-settings
 
    :language 'rust
    :feature 'comment
-   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+   '(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
 
    :language 'rust
    :feature 'delimiter
@@ -293,6 +293,17 @@ rust-ts-mode--font-lock-settings
    '((ERROR) @font-lock-warning-face))
   "Tree-sitter font-lock settings for `rust-ts-mode'.")
 
+(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
+  "Use the comment or documentation face appropriately for comments."
+  (let* ((beg (treesit-node-start node))
+         (end (treesit-node-end node))
+         (face (save-excursion
+                 (goto-char beg)
+                 (if (looking-at "///")
+                     'font-lock-doc-face
+                   'font-lock-comment-face))))
+    (treesit-fontify-with-override beg end face override start end)))
+
 (defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
   (let* ((case-fold-search nil)
          (face
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01  8:25   ` Christophe TROESTLER
@ 2023-12-01 21:38     ` Christophe TROESTLER
  2023-12-01 23:58     ` Dmitry Gutov
  1 sibling, 0 replies; 12+ messages in thread
From: Christophe TROESTLER @ 2023-12-01 21:38 UTC (permalink / raw)
  To: Emacs-devel

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

Hi,

A slightly updated patch (to encompass create level doc comments).

Best,
C.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-rust-ts-mode-appropriately-fontify-doc-strings.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-appropriately-fontify-doc-strings.patch", Size: 1707 bytes --]

From a5a6c31060962c976d7476da631a325c251a272d Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Thu, 30 Nov 2023 00:13:10 +0100
Subject: [PATCH] rust-ts-mode: appropriately fontify doc strings
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..0e24b09bbbb 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -153,7 +153,7 @@ rust-ts-mode--font-lock-settings
 
    :language 'rust
    :feature 'comment
-   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+   '(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
 
    :language 'rust
    :feature 'delimiter
@@ -293,6 +293,17 @@ rust-ts-mode--font-lock-settings
    '((ERROR) @font-lock-warning-face))
   "Tree-sitter font-lock settings for `rust-ts-mode'.")
 
+(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
+  "Use the comment or documentation face appropriately for comments."
+  (let* ((beg (treesit-node-start node))
+         (end (treesit-node-end node))
+         (face (save-excursion
+                 (goto-char beg)
+                 (if (looking-at "//\\(?:/\\|!\\)")
+                     'font-lock-doc-face
+                   'font-lock-comment-face))))
+    (treesit-fontify-with-override beg end face override start end)))
+
 (defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
   (let* ((case-fold-search nil)
          (face
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01  8:25   ` Christophe TROESTLER
  2023-12-01 21:38     ` Christophe TROESTLER
@ 2023-12-01 23:58     ` Dmitry Gutov
  2023-12-02  0:59       ` Christophe TROESTLER
                         ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Dmitry Gutov @ 2023-12-01 23:58 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: emacs-devel@gnu.org

On 01/12/2023 10:25, Christophe TROESTLER wrote:
> Hi,
> 
> On  1 December 2023 at 01:50 +01, Dmitry Gutov<dmitry@gutov.dev>  wrote:
>> On 30/11/2023 01:21, Christophe TROESTLER wrote:
>>> +         (prefix (buffer-substring-no-properties beg (min (+ beg 3) end)))
>>> +         (face (if (string-equal "///" prefix)
>> It'll probably be faster overall to use save-excursion and looking-at
>> instead of creating a substring.
> Thanks for your feedback. I did dome tests and the two are comparable (on Emacs 29.1) but here is a version that uses your suggestion.

Thanks! I'd rather err on the side of this one, even if initial testing 
shows the approaches are comparable. It's good to have verified that 
it's not slower, anyway.

I've pushed it to emacs-29. In the future, please send patches to the 
bug tracker, though (then it's easier to ensure they are not lost).



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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01 23:58     ` Dmitry Gutov
@ 2023-12-02  0:59       ` Christophe TROESTLER
  2023-12-02  3:41       ` Yuan Fu
  2023-12-02  7:55       ` Eli Zaretskii
  2 siblings, 0 replies; 12+ messages in thread
From: Christophe TROESTLER @ 2023-12-02  0:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel@gnu.org

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

On  2 December 2023 at 00:58 +01, Dmitry Gutov <dmitry@gutov.dev> wrote:
> […] I've pushed it to emacs-29. In the future, please send patches to
> the bug tracker, though (then it's easier to ensure they are not
> lost).

It seems my latest message has not reached the mailing list... (it ia attached).  I'll use the bug tracker from now on — for some reason, I was under the impression that Emacs patches should be sent first to Emacs devel.

Best,
C.



[-- Attachment #2: Type: message/rfc822, Size: 14965 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 90 bytes --]

Hi,

A slightly updated patch (to encompass create level doc comments).

Best,
C.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: 0001-rust-ts-mode-appropriately-fontify-doc-strings.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-appropriately-fontify-doc-strings.patch", Size: 1707 bytes --]

From a5a6c31060962c976d7476da631a325c251a272d Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Thu, 30 Nov 2023 00:13:10 +0100
Subject: [PATCH] rust-ts-mode: appropriately fontify doc strings
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..0e24b09bbbb 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -153,7 +153,7 @@ rust-ts-mode--font-lock-settings
 
    :language 'rust
    :feature 'comment
-   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+   '(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
 
    :language 'rust
    :feature 'delimiter
@@ -293,6 +293,17 @@ rust-ts-mode--font-lock-settings
    '((ERROR) @font-lock-warning-face))
   "Tree-sitter font-lock settings for `rust-ts-mode'.")
 
+(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
+  "Use the comment or documentation face appropriately for comments."
+  (let* ((beg (treesit-node-start node))
+         (end (treesit-node-end node))
+         (face (save-excursion
+                 (goto-char beg)
+                 (if (looking-at "//\\(?:/\\|!\\)")
+                     'font-lock-doc-face
+                   'font-lock-comment-face))))
+    (treesit-fontify-with-override beg end face override start end)))
+
 (defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
   (let* ((case-fold-search nil)
          (face
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01 23:58     ` Dmitry Gutov
  2023-12-02  0:59       ` Christophe TROESTLER
@ 2023-12-02  3:41       ` Yuan Fu
  2023-12-02  7:55       ` Eli Zaretskii
  2 siblings, 0 replies; 12+ messages in thread
From: Yuan Fu @ 2023-12-02  3:41 UTC (permalink / raw)
  To: emacs-devel



On 12/1/23 3:58 PM, Dmitry Gutov wrote:
> On 01/12/2023 10:25, Christophe TROESTLER wrote:
>> Hi,
>>
>> On  1 December 2023 at 01:50 +01, Dmitry Gutov<dmitry@gutov.dev>  
>> wrote:
>>> On 30/11/2023 01:21, Christophe TROESTLER wrote:
>>>> +         (prefix (buffer-substring-no-properties beg (min (+ beg 
>>>> 3) end)))
>>>> +         (face (if (string-equal "///" prefix)
>>> It'll probably be faster overall to use save-excursion and looking-at
>>> instead of creating a substring.
>> Thanks for your feedback. I did dome tests and the two are comparable 
>> (on Emacs 29.1) but here is a version that uses your suggestion.
>
> Thanks! I'd rather err on the side of this one, even if initial 
> testing shows the approaches are comparable. It's good to have 
> verified that it's not slower, anyway.
>
> I've pushed it to emacs-29. In the future, please send patches to the 
> bug tracker, though (then it's easier to ensure they are not lost).
>
Thanks to you both!

Yuan



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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-01 23:58     ` Dmitry Gutov
  2023-12-02  0:59       ` Christophe TROESTLER
  2023-12-02  3:41       ` Yuan Fu
@ 2023-12-02  7:55       ` Eli Zaretskii
  2023-12-02 10:40         ` Christophe TROESTLER
  2 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-12-02  7:55 UTC (permalink / raw)
  To: Dmitry Gutov, Christophe.TROESTLER; +Cc: emacs-devel

> Date: Sat, 2 Dec 2023 01:58:36 +0200
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 01/12/2023 10:25, Christophe TROESTLER wrote:
> > Hi,
> > 
> > On  1 December 2023 at 01:50 +01, Dmitry Gutov<dmitry@gutov.dev>  wrote:
> >> On 30/11/2023 01:21, Christophe TROESTLER wrote:
> >>> +         (prefix (buffer-substring-no-properties beg (min (+ beg 3) end)))
> >>> +         (face (if (string-equal "///" prefix)
> >> It'll probably be faster overall to use save-excursion and looking-at
> >> instead of creating a substring.
> > Thanks for your feedback. I did dome tests and the two are comparable (on Emacs 29.1) but here is a version that uses your suggestion.
> 
> Thanks! I'd rather err on the side of this one, even if initial testing 
> shows the approaches are comparable. It's good to have verified that 
> it's not slower, anyway.
> 
> I've pushed it to emacs-29.

This seems to result in

    ELC      progmodes/rust-ts-mode.elc

  In rust-ts-mode--comment-docstring:
  progmodes/rust-ts-mode.el:290:61: Warning: Unused lexical argument `end'



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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-02  7:55       ` Eli Zaretskii
@ 2023-12-02 10:40         ` Christophe TROESTLER
  2023-12-02 17:04           ` Dmitry Gutov
  0 siblings, 1 reply; 12+ messages in thread
From: Christophe TROESTLER @ 2023-12-02 10:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Dmitry Gutov, emacs-devel@gnu.org

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

On  2 December 2023 at 08:55 +01, Eli Zaretskii <eliz@gnu.org> wrote:
> […] This seems to result in
>
>     ELC      progmodes/rust-ts-mode.elc
>
>   In rust-ts-mode--comment-docstring:
>   progmodes/rust-ts-mode.el:290:61: Warning: Unused lexical argument `end'

Thanks for spotting this and sorry for it.  Here is an updated patch.

Best,
C.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-rust-ts-mode-appropriately-fontify-doc-strings.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-appropriately-fontify-doc-strings.patch", Size: 1723 bytes --]

From d734f421da6cbafeca489c9ad3ca722f3667f13a Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Thu, 30 Nov 2023 00:13:10 +0100
Subject: [PATCH] rust-ts-mode: appropriately fontify doc strings
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..1a1f6ace047 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -153,7 +153,7 @@ rust-ts-mode--font-lock-settings
 
    :language 'rust
    :feature 'comment
-   '(([(block_comment) (line_comment)]) @font-lock-comment-face)
+   '(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
 
    :language 'rust
    :feature 'delimiter
@@ -293,6 +293,17 @@ rust-ts-mode--font-lock-settings
    '((ERROR) @font-lock-warning-face))
   "Tree-sitter font-lock settings for `rust-ts-mode'.")
 
+(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
+  "Use the comment or documentation face appropriately for comments."
+  (let* ((beg (treesit-node-start node))
+         (face (save-excursion
+                 (goto-char beg)
+                 (if (looking-at "//\\(?:/\\|!\\)")
+                     'font-lock-doc-face
+                   'font-lock-comment-face))))
+    (treesit-fontify-with-override beg (treesit-node-end node)
+                                   face override start end)))
+
 (defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
   (let* ((case-fold-search nil)
          (face
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-02 10:40         ` Christophe TROESTLER
@ 2023-12-02 17:04           ` Dmitry Gutov
  2023-12-02 20:57             ` Christophe TROESTLER
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Gutov @ 2023-12-02 17:04 UTC (permalink / raw)
  To: Christophe TROESTLER, Eli Zaretskii; +Cc: emacs-devel@gnu.org

On 02/12/2023 12:40, Christophe TROESTLER wrote:
> On  2 December 2023 at 08:55 +01, Eli Zaretskii<eliz@gnu.org>  wrote:
>> […] This seems to result in
>>
>>      ELC      progmodes/rust-ts-mode.elc
>>
>>    In rust-ts-mode--comment-docstring:
>>    progmodes/rust-ts-mode.el:290:61: Warning: Unused lexical argument `end'
> Thanks for spotting this and sorry for it.  Here is an updated patch.

Thanks for the update, see commit a547b0e2e83 in emacs-29.

And I suppose for completeness, we should also support the "block" 
versions of the outer/inner docs? Like documented here:

https://doc.rust-lang.org/reference/comments.html

The description also mentions that

   ////

and

   /***

should be interpreted as "Only a comment", which will require a further 
more complex regexp. It's not urgent, this is just where googling led me to.



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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-02 17:04           ` Dmitry Gutov
@ 2023-12-02 20:57             ` Christophe TROESTLER
  2023-12-03 14:12               ` Dmitry Gutov
  0 siblings, 1 reply; 12+ messages in thread
From: Christophe TROESTLER @ 2023-12-02 20:57 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Eli Zaretskii, emacs-devel@gnu.org

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

On  2 December 2023 at 18:04 +01, Dmitry Gutov <dmitry@gutov.dev> wrote:
> […] And I suppose for completeness, we should also support the "block"
> versions of the outer/inner docs? […]

Sure.  Here is an updated patch (against emacs-29).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-rust-ts-mode-comment-docstring-handle-block-doc-comm.patch --]
[-- Type: text/x-diff; name="0001-rust-ts-mode-comment-docstring-handle-block-doc-comm.patch", Size: 1063 bytes --]

From ee3e6776ade9be3f396742feac688bbdf8c8c64f Mon Sep 17 00:00:00 2001
From: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Date: Sat, 2 Dec 2023 21:51:15 +0100
Subject: [PATCH] rust-ts-mode--comment-docstring: handle block doc comments
Content-Type: text/plain; charset="utf-8"

---
 lisp/progmodes/rust-ts-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 18951a10c55..8127aa956f4 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -292,7 +292,7 @@ rust-ts-mode--comment-docstring
   (let* ((beg (treesit-node-start node))
          (face (save-excursion
                  (goto-char beg)
-                 (if (looking-at "//\\(?:/\\|!\\)")
+                 (if (looking-at "/\\(?:/\\(?:/[^/]\\|!\\)\\|*\\(?:*[^*/]\\|!\\)\\)" t)
                      'font-lock-doc-face
                    'font-lock-comment-face))))
     (treesit-fontify-with-override beg (treesit-node-end node)
-- 
2.42.0


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

* Re: rust-ts-mode: appropriately fontify doc strings
  2023-12-02 20:57             ` Christophe TROESTLER
@ 2023-12-03 14:12               ` Dmitry Gutov
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Gutov @ 2023-12-03 14:12 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: Eli Zaretskii, emacs-devel@gnu.org

On 02/12/2023 22:57, Christophe TROESTLER wrote:
> On  2 December 2023 at 18:04 +01, Dmitry Gutov<dmitry@gutov.dev>  wrote:
>> […] And I suppose for completeness, we should also support the "block"
>> versions of the outer/inner docs? […]
> Sure.  Here is an updated patch (against emacs-29).
> 

Thanks! Pushed as a1f88963f5.



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

end of thread, other threads:[~2023-12-03 14:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-29 23:21 rust-ts-mode: appropriately fontify doc strings Christophe TROESTLER
2023-12-01  0:50 ` Dmitry Gutov
2023-12-01  8:25   ` Christophe TROESTLER
2023-12-01 21:38     ` Christophe TROESTLER
2023-12-01 23:58     ` Dmitry Gutov
2023-12-02  0:59       ` Christophe TROESTLER
2023-12-02  3:41       ` Yuan Fu
2023-12-02  7:55       ` Eli Zaretskii
2023-12-02 10:40         ` Christophe TROESTLER
2023-12-02 17:04           ` Dmitry Gutov
2023-12-02 20:57             ` Christophe TROESTLER
2023-12-03 14:12               ` Dmitry Gutov

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).