From: Christophe TROESTLER Date: Sat, 2 Dec 2023 16:58:40 +0000 (+0200) Subject: rust-ts-mode--comment-docstring: Fix/improve the previous change X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6c6abacfc610815298de726e6737d4c372f59c4b;p=emacs.git rust-ts-mode--comment-docstring: Fix/improve the previous change * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--comment-docstring): Match also "inner" line docs. Stop rebinding 'end' and use the argument's value in the 'treesit-fontify-with-override' call. --- diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 03ff2776d3a..1a1f6ace047 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -296,13 +296,13 @@ (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 "///") + (if (looking-at "//\\(?:/\\|!\\)") 'font-lock-doc-face 'font-lock-comment-face)))) - (treesit-fontify-with-override beg end face override start end))) + (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)