From unknown Thu Jun 19 14:02:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76597: 31.0.50; [PATCH] mhtml-ts-mode: fix indentation bugs and better CSS colouring. Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Feb 2025 20:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 76597 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 76597@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174060132325682 (code B ref -1); Wed, 26 Feb 2025 20:23:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Feb 2025 20:22:03 +0000 Received: from localhost ([127.0.0.1]:55633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnNut-0006gA-C5 for submit@debbugs.gnu.org; Wed, 26 Feb 2025 15:22:03 -0500 Received: from lists.gnu.org ([2001:470:142::17]:35512) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnNur-0006fX-9T for submit@debbugs.gnu.org; Wed, 26 Feb 2025 15:22:01 -0500 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 1tnNul-0004fb-3L for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2025 15:21:55 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tnNuj-0006iW-1z for bug-gnu-emacs@gnu.org; Wed, 26 Feb 2025 15:21:54 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5e04cb346eeso166053a12.2 for ; Wed, 26 Feb 2025 12:21:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740601311; x=1741206111; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5HYgcpDh0tAD0obK6l15y+4+f5oyaQZz6sLyatGZ758=; b=BJlYt8A9dvtTgGGr0sP2/QV018Ft7sv8NW7XA9qXSQvm1RHbFtperwJxrXZYkUTah3 +ZcYbGwSrYMxV5J00edLsmZn2qSoKo/5uVxeWuQPdUirw9yyzQuqlTYGl2pKVf/zTua4 YmGzwP/gXKyIfYNUx4nG7ChBpqnQZOQZjMIIsUtVZk3HieNfBrMgZvVeQc6/kKcJ/ZxH dqQc57QOQ0JDhLbKMGATNWXhLvaEpC3RCXMSOKWn9avZ1h4Nu0g+7TukgEIkuk2KQDn6 7NvuAoflfNVuQdi5TkiCRGaJAYpxf29RLZZ91Jtw1pNnPx3JNKzbCBq92GDIdX0MA0dq XGnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740601311; x=1741206111; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5HYgcpDh0tAD0obK6l15y+4+f5oyaQZz6sLyatGZ758=; b=hgPUFUKadxToj/iYcBz/bYiImx64JJli81SbDOvSg48IeehCHgnkBX7chyh077fDvL SfgKNkCxoj+Xw46HML4020a1yw+yYeX6eNOxMB5+lIZVI7Zp4eUFBxVeutDzVH3h05cX ikZgYJ/qMsuDCmcbVaJa7A04xdmcJDnW+vkzALsAXVSjQcDCiapI5XsECwnGGFETfgrm +R7lAiLOuO0aJE81ARpjr8L/2UGM64IGT+MJ2hzBBTFcb0WT2w66z+6xpCszteu8t+LN iTiqxborWL2oyyObDWanzrVlYHifl3TgOXItlnBeWTO01l84XUOZxqMQjxBEyAMi23by nBIA== X-Gm-Message-State: AOJu0Yz8Mp7yQrF4yCitmjZ7MP/lij4Rtpd5f5txX5b3ow1QIuBVVowO F3pdlCyQam3OgVXDpD7OFhJUvE52cwwGVh+80cpxJZNAqlUBGOSg1sybPQ== X-Gm-Gg: ASbGncuhFyRjuAVCi3U2YP+H59WeO9kX15mZTb4gQm219lCRptg8+zIgqxk+BJ++zJB iD1/u9koScKDzXHENH8+j8813C7Gz14gC1ovFglNR4yc9ZyvzMYwYNwa0adTlWwn/KBa2jDN8zC 78Jp7irv6QW3Ob9rvAdZAOllfwhV3o0we3AUYzfyjLi6+WjCph7TQD+nwrI5whV32c+zvjMoYeW 9Ir0jtGfaQLmUOUG326Y4NK+yLsze1AzRvR6eMuYCyVBzxsbzOIPDIoKPcrv6pP+zk52/6DCx/V yO9v1RYINwnGJ/cH8/CPSBNwzU6tiLT9qDhSKYiSVYrOQwB9utdxz8knSoMuOuv78w== X-Google-Smtp-Source: AGHT+IHkhwVF3BktXt7Iv5vTJBStTAVbTxl5XKsZG2PM6KVPumN4g2KRqO3ZFDPoxVkWCqhvlMuuPg== X-Received: by 2002:a17:907:7296:b0:abb:eaf5:2121 with SMTP id a640c23a62f3a-abc09c1a0f8mr2674029166b.40.1740601310614; Wed, 26 Feb 2025 12:21:50 -0800 (PST) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abed1d5ad9bsm389232266b.64.2025.02.26.12.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2025 12:21:50 -0800 (PST) From: Vincenzo Pupillo Date: Wed, 26 Feb 2025 21:21:49 +0100 Message-ID: <4986307.OV4Wx5bFTl@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart26833907.1r3eYUQgxm" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=v.pupillo@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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.0 (/) This is a multi-part message in MIME format. --nextPart26833907.1r3eYUQgxm Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Ciao, The attached patch fixes some indentation blocking bugs. It also adds the coloring of "color_value" for CSS. The discussion took place in this thread https://lists.gnu.org/archive/html/ emacs-devel/2025-02/msg00610.html Thanks. Vincenzo --nextPart26833907.1r3eYUQgxm Content-Disposition: attachment; filename="0001-Fix-CSS-indentation-added-support-for-CSS-color_valu.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Fix-CSS-indentation-added-support-for-CSS-color_valu.patch" >From d646a4039372f6f55d7860cee076bd718e05097e Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Wed, 19 Feb 2025 21:47:23 +0100 Subject: [PATCH] Fix CSS indentation, added support for CSS 'color_value'. * lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--colorize-css-value): Added 'color_value' node, refactoring. (mhtml-ts-mode--treesit-font-lock-settings): Added 'color_value' node. (mhtml-ts-mode--treesit-indent-rules): Removed the old comment and fixed the CSS indentation rule. --- lisp/textmodes/mhtml-ts-mode.el | 37 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el index 83f8879f427..211ccccb88a 100644 --- a/lisp/textmodes/mhtml-ts-mode.el +++ b/lisp/textmodes/mhtml-ts-mode.el @@ -232,21 +232,23 @@ mhtml-ts-mode--language-at-point (defun mhtml-ts-mode--colorize-css-value (node override start end &rest _) "Colorize CSS property value like `css--fontify-region'. For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'." - (if (and mhtml-ts-mode-css-fontify-colors - (string-equal "plain_value" (treesit-node-type node))) - (let ((color (css--compute-color start (treesit-node-text node t)))) - (when color - (with-silent-modifications - (add-text-properties - (treesit-node-start node) (treesit-node-end node) - (list 'face (list :background color - :foreground (readable-foreground-color - color) - :box '(:line-width -1))))))) + (let ((node-start (treesit-node-start node)) + (node-end (treesit-node-end node))) (treesit-fontify-with-override - (treesit-node-start node) (treesit-node-end node) + node-start node-end 'font-lock-variable-name-face - override start end))) + override start end) + ;; apply color if required + (when-let* ((ok (and mhtml-ts-mode-css-fontify-colors + (member (treesit-node-type node) '("plain_value" "color_value")))) + (color (css--compute-color start (treesit-node-text node t)))) + (with-silent-modifications + (add-text-properties + node-start node-end + (list 'face (list :background color + :foreground (readable-foreground-color + color) + :box '(:line-width -1)))))))) ;; Embedded languages should be indented according to the language ;; that embeds them. @@ -293,8 +295,8 @@ mhtml-ts-mode--treesit-font-lock-settings :language 'css :override t :feature 'variable - '((plain_value) @font-lock-variable-name-face - (plain_value) @mhtml-ts-mode--colorize-css-value)) + '((plain_value) @mhtml-ts-mode--colorize-css-value + (color_value) @mhtml-ts-mode--colorize-css-value)) css--treesit-settings)) "Settings for `treesit-font-lock-settings'.") @@ -338,9 +340,8 @@ mhtml-ts-mode--treesit-indent-rules `((css ((parent-is "stylesheet") mhtml-ts-mode--js-css-tag-bol mhtml-ts-mode--js-css-indent-offset))) - css--treesit-indent-rules 'prepend) - :replace)) - "Settings for `treesit-simple-indent-rules'.") + css--treesit-indent-rules + :prepend)))) (defvar mhtml-ts-mode--treesit-aggregated-simple-imenu-settings `((html ,@html-ts-mode--treesit-simple-imenu-settings) -- 2.48.1 --nextPart26833907.1r3eYUQgxm-- From unknown Thu Jun 19 14:02:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76597: 31.0.50; [PATCH] mhtml-ts-mode: fix indentation bugs and better CSS colouring. Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Feb 2025 18:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76597 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vincenzo Pupillo Cc: 76597@debbugs.gnu.org Received: via spool by 76597-submit@debbugs.gnu.org id=B76597.174067966918080 (code B ref 76597); Thu, 27 Feb 2025 18:08:03 +0000 Received: (at 76597) by debbugs.gnu.org; 27 Feb 2025 18:07:49 +0000 Received: from localhost ([127.0.0.1]:37523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tniIW-0004hW-Lq for submit@debbugs.gnu.org; Thu, 27 Feb 2025 13:07:48 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39237) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tniIU-0004gg-3q; Thu, 27 Feb 2025 13:07:46 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 57E684450E; Thu, 27 Feb 2025 18:07:36 +0000 (UTC) From: Juri Linkov In-Reply-To: <4986307.OV4Wx5bFTl@fedora> Organization: LINKOV.NET References: <4986307.OV4Wx5bFTl@fedora> Date: Thu, 27 Feb 2025 20:06:35 +0200 Message-ID: <87tt8fuus4.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekkedugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepleeiveeutdehfedtgedutdeileehkeegheevgeehtdfgueeuiedvvdfhveekvefgnecuffhomhgrihhnpehgnhhurdhorhhgnecukfhppeeluddruddvledruddthedruddujeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledruddthedruddujedphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheptghonhhtrhholhesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopeejieehleejseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvhdrphhuphhilhhlohesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net 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 (-) close 76597 31.0.50 thanks > The attached patch fixes some indentation blocking bugs. It also adds the > coloring of "color_value" for CSS. > The discussion took place in this thread > https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00610.html Thanks, I have tested your patch, and confirm that now indentation is correct, so now pushed to master.