From unknown Thu Sep 11 18:37:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Aug 2025 20:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 79258 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 79258@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17553770609917 (code B ref -1); Sat, 16 Aug 2025 20:45:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Aug 2025 20:44:20 +0000 Received: from localhost ([127.0.0.1]:43720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unNlD-0002Zt-Ni for submit@debbugs.gnu.org; Sat, 16 Aug 2025 16:44:20 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56040) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unNlA-0002ZY-GQ for submit@debbugs.gnu.org; Sat, 16 Aug 2025 16:44:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unNl5-0007Ke-0Q for bug-gnu-emacs@gnu.org; Sat, 16 Aug 2025 16:44:11 -0400 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unNl3-0007wR-9T for bug-gnu-emacs@gnu.org; Sat, 16 Aug 2025 16:44:10 -0400 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 56FC81400078 for ; Sat, 16 Aug 2025 16:44:07 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Sat, 16 Aug 2025 16:44:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1755377047; x=1755463447; bh=MVjsSaaeUtA67owUmjFtKIS3s5CBSBCq zVE3QFtapQg=; b=Z8I18MpfKCamA1+GDklAatunPJLjiD9bDvEkKNnV4bYE+Hat 8ct2kakUelyTsq6rtxO58FV0jJwTi8RId2lRyUmcSrpdXtrfX8eXXqM3OqWqYRFY JhTPvWZKQU2IwipwZyLWGlkTnvGaa/CN9w8nfemb0qPdYlLxt0YgdMfJFTJ7rdPI Pg/GPs1e1cDjZSpvr3rO2BjJCdy9++CM+ih84hjG3QUe53icw2h+hWCwbJ0F99tX WpDv9mZHbSuAvh2I+W8Fxp5WlA74fQODOCsKA+3/21F8SKpRPNDni8K4PMXnKNDD BWQ9yhtXsTGuk/2Xx+CKOswKMgoj7jliaWo2Vw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1755377047; x= 1755463447; bh=MVjsSaaeUtA67owUmjFtKIS3s5CBSBCqzVE3QFtapQg=; b=R g5DSqL6NxJr1/L4kBEDgCMGyiYUsLjXsT0JQU6InRZAKX6cBT8l/bUxCkVMntZVr VmLQy5wtttzWaUt1Uqx4qkzwN1QX0FROMaJfSAFDP9L9Vygzhf1OL+GajSU6P/ZZ r6Axeo0yI4s+Ik01Lpy+Ns1EhZniwOo33BmRu6qnidCd230PmNoRMdTU/35l/n55 owC0k/UcfTe/wUG7IdDcqEqL4eXg5ViUis57qhgX9ZBovQNgxgFtIoDDx/nUTpS4 irewSukcT1aai1FUm0ov41alM+GWauFWYD2Bg4aQOq5p2nL02eFnNKFtXJSTDsJq zumSUrDlrtF3YTyPQu6YA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddugeejkeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkfgggtgesmhdtreertdertd enucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffr rghtthgvrhhnpedugfeftdejffevheeggedvieffgefgtedthfeiveeigfettdelveffhe efteettdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 16 Aug 2025 16:44:06 -0400 (EDT) From: john muhl Date: Sat, 16 Aug 2025 15:43:56 -0500 Message-ID: <87ldnj6lpv.fsf@pub.pink> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.152; envelope-from=jm@pub.pink; helo=fhigh-a1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= Content-Type: text/plain Tags: patch Add font-lock-comment-delimiter face to all the initial dashes in single line comments. Some popular documentation styles recommend triple dashes and it looks better to have all the dashes in the same face. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Face-ify-all-comment-delimiters-in-lua-ts-mode.patch >From 06671f6cb239f1807b934eb189e771b9737856aa Mon Sep 17 00:00:00 2001 From: john muhl Date: Wed, 14 May 2025 08:53:42 -0500 Subject: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' * lisp/progmodes/lua-ts-mode.el (lua-ts--comment-font-lock): Apply 'font-lock-comment-delimiter-face' to the entire span of initial dashes. In particular, this improves the appearance of LuaCATS and EmmyLua style annotations which use "---". * test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua: Add tests. --- lisp/progmodes/lua-ts-mode.el | 7 +++++-- test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 07a8f0aef55..c51c7e7aef8 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -168,10 +168,13 @@ lua-ts--comment-font-lock (let* ((node-start (treesit-node-start node)) (node-end (treesit-node-end node)) (node-text (treesit-node-text node t)) - (delimiter-end (+ 2 node-start))) + (delimiter-end (progn + (goto-char node-start) + (while (looking-at-p "-") (forward-char)) + (point)))) (when (and (>= node-start start) (<= delimiter-end end) - (string-match "\\`--" node-text)) + (string-match "\\`---*" node-text)) (treesit-fontify-with-override node-start delimiter-end 'font-lock-comment-delimiter-face diff --git a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua index 93d589e3825..5a36bcad10b 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua +++ b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua @@ -11,6 +11,11 @@ Multi-line comment -- <- font-lock-comment-face local line_comment = "comment" -- comment -- ^ font-lock-comment-face +---@alias MyNumber integer +-- <- font-lock-comment-delimiter-face +------Calculate new number +-- ^ font-lock-comment-delimiter-face +function calc() end -- Definition local function f1() end -- 2.50.1 --=-=-=-- From unknown Thu Sep 11 18:37:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Aug 2025 12:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79258 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: john muhl Cc: 79258@debbugs.gnu.org Received: via spool by 79258-submit@debbugs.gnu.org id=B79258.175595045414705 (code B ref 79258); Sat, 23 Aug 2025 12:01:02 +0000 Received: (at 79258) by debbugs.gnu.org; 23 Aug 2025 12:00:54 +0000 Received: from localhost ([127.0.0.1]:38951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upmvW-0003p7-46 for submit@debbugs.gnu.org; Sat, 23 Aug 2025 08:00:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47154) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upmvT-0003or-RH for 79258@debbugs.gnu.org; Sat, 23 Aug 2025 08:00:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1upmvN-0005YJ-K4; Sat, 23 Aug 2025 08:00:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mhjyxOm97dLQwX8XwW39epxq4J1GKCRXRq5241K62sE=; b=VCnOKsH1A/tF Gf4Dm5EtEAc7Ux7OgKrgr/bkCHfRhDrXFyydpx4phvCZjj1EE+Fr3PrVaDXOyBvDBh8zMwsZ2efPp 7CS7NYWzvglaW4e27nCeGqSWFyM/x38wzQmnhIBJ0tTMFdkZ8PdsIFdbM5S/1tpr2uj6REWQISwBY gQPWufaZW+j8jpVK1tq+rsIrMpQOxrIvCMvLgGY0at3le0xgKhypWGL55pXVRGLEtxmgFdz83yjuL 2okQOXVvmUtrNSCRQMYEowm7Ed2Y8yDIYjH2kxqLRlMXcy6B+jbcVyRjZPmXpc92J4mL/IP4LLHJ4 pZUA70fneGncMuvDEpRkPA==; Date: Sat, 23 Aug 2025 15:00:42 +0300 Message-Id: <86cy8mb639.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87ldnj6lpv.fsf@pub.pink> (message from john muhl on Sat, 16 Aug 2025 15:43:56 -0500) References: <87ldnj6lpv.fsf@pub.pink> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: john muhl > Date: Sat, 16 Aug 2025 15:43:56 -0500 > > Add font-lock-comment-delimiter face to all the initial dashes in single > line comments. Some popular documentation styles recommend triple dashes > and it looks better to have all the dashes in the same face. Thanks, but shouldn't the code which moves point be in save-excursion in this case? If not, why not? From unknown Thu Sep 11 18:37:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Aug 2025 16:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79258 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 79258@debbugs.gnu.org Received: via spool by 79258-submit@debbugs.gnu.org id=B79258.17559667852415 (code B ref 79258); Sat, 23 Aug 2025 16:34:02 +0000 Received: (at 79258) by debbugs.gnu.org; 23 Aug 2025 16:33:05 +0000 Received: from localhost ([127.0.0.1]:41478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uprAu-0000ct-OF for submit@debbugs.gnu.org; Sat, 23 Aug 2025 12:33:05 -0400 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]:38991) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uprAr-0000c7-OF for 79258@debbugs.gnu.org; Sat, 23 Aug 2025 12:33:02 -0400 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4A5DA7A0068; Sat, 23 Aug 2025 12:32:56 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Sat, 23 Aug 2025 12:32:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1755966776; x=1756053176; bh=LNfu0o/c6J +jF2XULzz2Tb4FeXIYBcUzdjLvBBccSWQ=; b=Xz0JYbg46dsYjwgSwtbEJGUGLB EIXQYYty43WdYGrJcRPs6YFJbaCyjMx+JYTCXyMYuENjLPFIOKyTCWhcP9hIWnH8 h0gBJr+qJc3VV214JvFrSta/kfKZnLg1Cly6YEQC7wNS2873FHEE9yXA1YqLSbd/ 91Vr85P3BSDuhzhMwrH3zTBjB6Nr1X5Idv5NDGaGRUB7ArpyD2FKalq9WdzPlPjU kDkODe+/UKHLp0+8gVQ+cj4JlV6gGmizo28L5IXIEWIzDcFHZMqWhPySU9YhbdwJ nPde+VrTEwAfx3HxHcBwJfm+7rHheDZ9IWYrYcrfHceAuSf/qndqYm04/g/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1755966776; x=1756053176; bh=LNfu0o/c6J+jF2XULzz2Tb4FeXIYBcUzdjL vBBccSWQ=; b=bjA9wl4CotRKUEVPhfSNUkJF2FQUxI4biz5geAztDeWez+VdxoB PZAJ6HOt2tZQ6rcGv0FmhDf5PMRNOK2GEhdDt53S9Syp0yDW1poQUxwsc4HlL8Pj aaO5LUu5NHNIgODZky+a4EPWrJQJMV0LxefIN6ScgBaE/aEZ4QF69DhgchdCwbuy 6NUC83md2w54/NUJniS1p2uUHpuf0b3N9biU51fA76bwZt9g4kq2+7hgRbEZEwUg rUvRr/nQL0Kc21Ia4gNVJTgOvCokzlfS97DpvJzW3eXRWqseUY/6N+NT/hXzeBoV xHNNWgZss2tdrba2/IEs1RZvo6NOhAW49Yg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduieejuddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkfgggtgesmhdtreertderjeenucfhrhhomhepjhhohhhnuchm uhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrghtthgvrhhnpeeutdffieefue dvvdfhtddvfefgvdffgeduvdffudeggffhueethefggedtteefteenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjmhesphhusgdrphhinhhkpd hnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeejledv heekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghlihiisehgnhhurd horhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Aug 2025 12:32:55 -0400 (EDT) From: john muhl In-Reply-To: <86cy8mb639.fsf@gnu.org> References: <87ldnj6lpv.fsf@pub.pink> <86cy8mb639.fsf@gnu.org> Date: Sat, 23 Aug 2025 11:32:48 -0500 Message-ID: <874ity80cv.fsf@pub.pink> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: john muhl >> Date: Sat, 16 Aug 2025 15:43:56 -0500 >>=20 >> Add font-lock-comment-delimiter face to all the initial dashes in single >> line comments. Some popular documentation styles recommend triple dashes >> and it looks better to have all the dashes in the same face. > > Thanks, but shouldn't the code which moves point be in save-excursion > in this case? If not, why not? I thought the font-lock machinery took care of it. If I followed the code correctly then we eventually end up in font-lock-default-fontify-syntactically which uses save-excursion. Checking the position of point at the beginning of lua-ts--comment-font-lock shows that it has already been moved (to the end of the line/comment) before there is any chance to call save-excursion from here so the position it would restore isn=E2=80=99t where the user has the point at anyway. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fontify-all-comment-delimiters-in-lua-ts-mode.patch >From a853945220606aec211156cee84d3b16bb5cefc3 Mon Sep 17 00:00:00 2001 From: john muhl Date: Wed, 14 May 2025 08:53:42 -0500 Subject: [PATCH] Fontify all comment delimiters in 'lua-ts-mode' * lisp/progmodes/lua-ts-mode.el (lua-ts--comment-font-lock): Apply 'font-lock-comment-delimiter-face' to the entire span of initial dashes. In particular, this improves the appearance of LuaCATS and EmmyLua style annotations which use "---". * test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua: Add tests. (Bug#79258) --- lisp/progmodes/lua-ts-mode.el | 7 +++++-- test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 5e58d4c071d..44d622b4a77 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -163,10 +163,13 @@ lua-ts--comment-font-lock (let* ((node-start (treesit-node-start node)) (node-end (treesit-node-end node)) (node-text (treesit-node-text node t)) - (delimiter-end (+ 2 node-start))) + (delimiter-end (progn + (goto-char node-start) + (while (looking-at-p "-") (forward-char)) + (point)))) (when (and (>= node-start start) (<= delimiter-end end) - (string-match "\\`--" node-text)) + (string-match "\\`---*" node-text)) (treesit-fontify-with-override node-start delimiter-end 'font-lock-comment-delimiter-face diff --git a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua index 93d589e3825..5a36bcad10b 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua +++ b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua @@ -11,6 +11,11 @@ Multi-line comment -- <- font-lock-comment-face local line_comment = "comment" -- comment -- ^ font-lock-comment-face +---@alias MyNumber integer +-- <- font-lock-comment-delimiter-face +------Calculate new number +-- ^ font-lock-comment-delimiter-face +function calc() end -- Definition local function f1() end -- 2.50.1 --=-=-=-- From unknown Thu Sep 11 18:37:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: john muhl Subject: bug#79258: closed (Re: bug#79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode') Message-ID: References: <864itpqkez.fsf@gnu.org> <87ldnj6lpv.fsf@pub.pink> X-Gnu-PR-Message: they-closed 79258 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 79258@debbugs.gnu.org Date: Sat, 30 Aug 2025 08:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1756542782-18807-1" This is a multi-part message in MIME format... ------------=_1756542782-18807-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 79258@debbugs.gnu.org. --=20 79258: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79258 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1756542782-18807-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 79258-done) by debbugs.gnu.org; 30 Aug 2025 08:32:48 +0000 Received: from localhost ([127.0.0.1]:44699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1usH0x-0004sY-RU for submit@debbugs.gnu.org; Sat, 30 Aug 2025 04:32:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45454) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1usH0v-0004s7-Dj for 79258-done@debbugs.gnu.org; Sat, 30 Aug 2025 04:32:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usH0p-0002YH-Eo; Sat, 30 Aug 2025 04:32:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=4gFvn5Ve/wgdh5tDKpgBTmpqkN7eG+EDm+oy0Mq8fJY=; b=b/J6OUlA2v66aJIaiKtp zk/NRC23Kgzn9EfK+Xv1fi+wri1zDnjQlAFE3B40I9wmvriwvQ9GISSCka3PjwmYOPYR7FBoXH7vC e8hWiBcC77Ar3HDEhZ2nNeKSDKvcdNqTFz0+mcPBFuNskzfYHoMV4nZmuKX8BWtsp4uXnAacLxnTq ZBrLVbpJ5doi//HtV13XNYN6N/DLF4HSTvk7IO/21WYKJNeH3uQosz6UcDDS1BXAuaAQMpzO6p5xY FVSDNKIBQ0frGo8qTfBJLuJ6slKUGLm2wbYsgWUEisfd9aWkCSA9Bk7bAsi+w4jSGgIYTC31LbNhY lZaOG828MfLObg==; Date: Sat, 30 Aug 2025 11:32:36 +0300 Message-Id: <864itpqkez.fsf@gnu.org> From: Eli Zaretskii To: john muhl In-Reply-To: <874ity80cv.fsf@pub.pink> (message from john muhl on Sat, 23 Aug 2025 11:32:48 -0500) Subject: Re: bug#79258: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' References: <87ldnj6lpv.fsf@pub.pink> <86cy8mb639.fsf@gnu.org> <874ity80cv.fsf@pub.pink> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79258-done Cc: 79258-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: john muhl > Cc: 79258@debbugs.gnu.org > Date: Sat, 23 Aug 2025 11:32:48 -0500 > > Eli Zaretskii writes: > > >> From: john muhl > >> Date: Sat, 16 Aug 2025 15:43:56 -0500 > >> > >> Add font-lock-comment-delimiter face to all the initial dashes in single > >> line comments. Some popular documentation styles recommend triple dashes > >> and it looks better to have all the dashes in the same face. > > > > Thanks, but shouldn't the code which moves point be in save-excursion > > in this case? If not, why not? > > I thought the font-lock machinery took care of it. If I followed > the code correctly then we eventually end up in > font-lock-default-fontify-syntactically which uses save-excursion. > > Checking the position of point at the beginning of > lua-ts--comment-font-lock shows that it has already been moved (to > the end of the line/comment) before there is any chance to call > save-excursion from here so the position it would restore isn’t > where the user has the point at anyway. Thanks, now installed on the master branch, and closing the bug. ------------=_1756542782-18807-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Aug 2025 20:44:20 +0000 Received: from localhost ([127.0.0.1]:43720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unNlD-0002Zt-Ni for submit@debbugs.gnu.org; Sat, 16 Aug 2025 16:44:20 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56040) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unNlA-0002ZY-GQ for submit@debbugs.gnu.org; Sat, 16 Aug 2025 16:44:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unNl5-0007Ke-0Q for bug-gnu-emacs@gnu.org; Sat, 16 Aug 2025 16:44:11 -0400 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1unNl3-0007wR-9T for bug-gnu-emacs@gnu.org; Sat, 16 Aug 2025 16:44:10 -0400 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 56FC81400078 for ; Sat, 16 Aug 2025 16:44:07 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Sat, 16 Aug 2025 16:44:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1755377047; x=1755463447; bh=MVjsSaaeUtA67owUmjFtKIS3s5CBSBCq zVE3QFtapQg=; b=Z8I18MpfKCamA1+GDklAatunPJLjiD9bDvEkKNnV4bYE+Hat 8ct2kakUelyTsq6rtxO58FV0jJwTi8RId2lRyUmcSrpdXtrfX8eXXqM3OqWqYRFY JhTPvWZKQU2IwipwZyLWGlkTnvGaa/CN9w8nfemb0qPdYlLxt0YgdMfJFTJ7rdPI Pg/GPs1e1cDjZSpvr3rO2BjJCdy9++CM+ih84hjG3QUe53icw2h+hWCwbJ0F99tX WpDv9mZHbSuAvh2I+W8Fxp5WlA74fQODOCsKA+3/21F8SKpRPNDni8K4PMXnKNDD BWQ9yhtXsTGuk/2Xx+CKOswKMgoj7jliaWo2Vw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1755377047; x= 1755463447; bh=MVjsSaaeUtA67owUmjFtKIS3s5CBSBCqzVE3QFtapQg=; b=R g5DSqL6NxJr1/L4kBEDgCMGyiYUsLjXsT0JQU6InRZAKX6cBT8l/bUxCkVMntZVr VmLQy5wtttzWaUt1Uqx4qkzwN1QX0FROMaJfSAFDP9L9Vygzhf1OL+GajSU6P/ZZ r6Axeo0yI4s+Ik01Lpy+Ns1EhZniwOo33BmRu6qnidCd230PmNoRMdTU/35l/n55 owC0k/UcfTe/wUG7IdDcqEqL4eXg5ViUis57qhgX9ZBovQNgxgFtIoDDx/nUTpS4 irewSukcT1aai1FUm0ov41alM+GWauFWYD2Bg4aQOq5p2nL02eFnNKFtXJSTDsJq zumSUrDlrtF3YTyPQu6YA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddugeejkeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkfgggtgesmhdtreertdertd enucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffr rghtthgvrhhnpedugfeftdejffevheeggedvieffgefgtedthfeiveeigfettdelveffhe efteettdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 16 Aug 2025 16:44:06 -0400 (EDT) From: john muhl To: bug-gnu-emacs@gnu.org Subject: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' X-Debbugs-Cc: Date: Sat, 16 Aug 2025 15:43:56 -0500 Message-ID: <87ldnj6lpv.fsf@pub.pink> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.152; envelope-from=jm@pub.pink; helo=fhigh-a1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= Content-Type: text/plain Tags: patch Add font-lock-comment-delimiter face to all the initial dashes in single line comments. Some popular documentation styles recommend triple dashes and it looks better to have all the dashes in the same face. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Face-ify-all-comment-delimiters-in-lua-ts-mode.patch >From 06671f6cb239f1807b934eb189e771b9737856aa Mon Sep 17 00:00:00 2001 From: john muhl Date: Wed, 14 May 2025 08:53:42 -0500 Subject: [PATCH] Face-ify all comment delimiters in 'lua-ts-mode' * lisp/progmodes/lua-ts-mode.el (lua-ts--comment-font-lock): Apply 'font-lock-comment-delimiter-face' to the entire span of initial dashes. In particular, this improves the appearance of LuaCATS and EmmyLua style annotations which use "---". * test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua: Add tests. --- lisp/progmodes/lua-ts-mode.el | 7 +++++-- test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 07a8f0aef55..c51c7e7aef8 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -168,10 +168,13 @@ lua-ts--comment-font-lock (let* ((node-start (treesit-node-start node)) (node-end (treesit-node-end node)) (node-text (treesit-node-text node t)) - (delimiter-end (+ 2 node-start))) + (delimiter-end (progn + (goto-char node-start) + (while (looking-at-p "-") (forward-char)) + (point)))) (when (and (>= node-start start) (<= delimiter-end end) - (string-match "\\`--" node-text)) + (string-match "\\`---*" node-text)) (treesit-fontify-with-override node-start delimiter-end 'font-lock-comment-delimiter-face diff --git a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua index 93d589e3825..5a36bcad10b 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua +++ b/test/lisp/progmodes/lua-ts-mode-resources/font-lock.lua @@ -11,6 +11,11 @@ Multi-line comment -- <- font-lock-comment-face local line_comment = "comment" -- comment -- ^ font-lock-comment-face +---@alias MyNumber integer +-- <- font-lock-comment-delimiter-face +------Calculate new number +-- ^ font-lock-comment-delimiter-face +function calc() end -- Definition local function f1() end -- 2.50.1 --=-=-=-- ------------=_1756542782-18807-1--