From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 20 15:11:08 2023 Received: (at submit) by debbugs.gnu.org; 20 Jan 2023 20:11:08 +0000 Received: from localhost ([127.0.0.1]:47227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIxj9-0007Fa-Kx for submit@debbugs.gnu.org; Fri, 20 Jan 2023 15:11:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:53358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIxj8-0007FR-Hv for submit@debbugs.gnu.org; Fri, 20 Jan 2023 15:11:07 -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 1pIxj6-0004Ms-WF for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2023 15:11:05 -0500 Received: from out0.migadu.com ([2001:41d0:2:267::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIxj3-0004BX-Ow for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2023 15:11:04 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674245458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=XlaRNRKfQ5PTnYZMHwsHIPMjCfICB1KjnQvdf5uqSpQ=; b=VOcpY8HEP6HHjrneRG+hntJvBm3HJN54N9n9AxpGKMzf/30M76G0AHmwE9p/68cLRPbd+i rskJlEtAyvsV5CrIGwze26sDKgtw0mGg2VrWJnJ8GMCBmo7qzkBawFCTVk66kEH66RQALB 8pCpOo93AWqPY75U2BS1AMM3qPeOXJUIuOHYBSfrzRC3SQjo5p7BbkLj2K8z/+f30G7s9H VQOb5vNoCdvvzIn2vMx2EwUOxYf6stpUS0dxHryDxOJxPm0fgBfqR/0sufy7jhZ18uuwls 0faNB/gRi3Q2AImy57byR9h8f7SD26/4LIlZIDYIQTJZdg3jBeE7snfYUjW/9A== From: Theodor Thornhill To: bug-gnu-emacs@gnu.org Subject: 30.0.50; [PATCH]: Add html-ts-mode X-Debbugs-Cc: eliz@gnu.org Date: Fri, 20 Jan 2023 21:10:56 +0100 Message-ID: <87edrpklv3.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=theo@thornhill.no; helo=out0.migadu.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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: -2.4 (--) --=-=-= Content-Type: text/plain Hi! Attached is a ts-mode for HTML support. @Eli, is this ok for emacs-29, or should it go to master? If ok for 29 I'll remove the sentence/sexp-related stuff and commit that later on master. Otherwise I'll just add everything to master. Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-html-ts-mode.patch >From 370e8478723af410f240a20f8b6640bdaf0a6594 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 20 Jan 2023 21:05:41 +0100 Subject: [PATCH] Add html-ts-mode * lisp/textmodes/html-ts-mode.el: New major mode for HTML support powered by Tree-sitter. --- lisp/textmodes/html-ts-mode.el | 134 +++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 lisp/textmodes/html-ts-mode.el diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el new file mode 100644 index 0000000000..6016a3dd72 --- /dev/null +++ b/lisp/textmodes/html-ts-mode.el @@ -0,0 +1,134 @@ +;;; html-ts-mode.el --- tree-sitter support for HTML -*- lexical-binding: t; -*- + +;; Copyright (C) 2022-2023 Free Software Foundation, Inc. + +;; Author : Theodor Thornhill +;; Maintainer : Theodor Thornhill +;; Created : November 2022 +;; Keywords : html languages tree-sitter + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; + +;;; Code: + +(require 'treesit) +(require 'sgml-mode) + +(declare-function treesit-parser-create "treesit.c") +(declare-function treesit-node-type "treesit.c") + +(defcustom html-ts-mode-indent-offset 2 + "Number of spaces for each indentation step in `html-ts-mode'." + :version "29.1" + :type 'integer + :safe 'integerp + :group 'html) + +(defvar html-ts-mode--indent-rules + `((html + ((parent-is "fragment") parent-bol 0) + ((node-is "/>") parent-bol 0) + ((node-is ">") parent-bol 0) + ((node-is "end_tag") parent-bol 0) + ((parent-is "comment") prev-adaptive-prefix 0) + ((parent-is "element") parent-bol html-ts-mode-indent-offset) + ((parent-is "script_element") parent-bol html-ts-mode-indent-offset) + ((parent-is "style_element") parent-bol html-ts-mode-indent-offset) + ((parent-is "start_tag") parent-bol html-ts-mode-indent-offset) + ((parent-is "self_closing_tag") parent-bol html-ts-mode-indent-offset))) + "Tree-sitter indent rules.") + +(defvar html-ts-mode--font-lock-settings + (treesit-font-lock-rules + :language 'html + :override t + :feature 'comment + `((comment) @font-lock-comment-face) + :language 'html + :override t + :feature 'keyword + `("doctype" @font-lock-keyword-face) + :language 'html + :override t + :feature 'definition + `((tag_name) @font-lock-function-name-face) + :language 'html + :override t + :feature 'string + `((quoted_attribute_value) @font-lock-string-face) + :language 'html + :override t + :feature 'property + `((attribute_name) @font-lock-variable-name-face)) + "Tree-sitter font-lock settings for `html-ts-mode'.") + +(defun html-ts-mode--defun-name (node) + "Return the defun name of NODE. +Return nil if there is no name or if NODE is not a defun node." + (when (equal (treesit-node-type node) "tag_name") + (treesit-node-text node t))) + +;;;###autoload +(define-derived-mode html-ts-mode html-mode "HTML" + "Major mode for editing Html, powered by tree-sitter." + :group 'html + + (unless (treesit-ready-p 'html) + (error "Tree-sitter for HTML isn't available")) + + (treesit-parser-create 'html) + + ;; Comments. + (setq-local treesit-text-type-regexp + (regexp-opt '("comment" "text"))) + + ;; Indent. + (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) + + ;; Navigation. + (setq-local treesit-defun-type-regexp "element") + + (setq-local treesit-defun-name-function #'html-ts-mode--defun-name) + + (setq-local treesit-sentence-type-regexp + (regexp-opt '("start_tag" + "self_closing_tag" + "end_tag"))) + + (setq-local treesit-sexp-type-regexp + (regexp-opt '("tag" + "text" + "attribute" + "value"))) + + ;; Font-lock. + (setq-local treesit-font-lock-settings html-ts-mode--font-lock-settings) + (setq-local treesit-font-lock-feature-list + '((comment keyword definition) + (property string) + () ())) + + ;; Imenu. + (setq-local treesit-simple-imenu-settings + '(("Element" "\\`tag_name\\'" nil nil))) + (treesit-major-mode-setup)) + +(provide 'html-ts-mode) + +;;; html-ts-mode.el ends here -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 20 15:29:04 2023 Received: (at 60972) by debbugs.gnu.org; 20 Jan 2023 20:29:04 +0000 Received: from localhost ([127.0.0.1]:47243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIy0V-0007ex-Sn for submit@debbugs.gnu.org; Fri, 20 Jan 2023 15:29:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIy0T-0007eU-Nc for 60972@debbugs.gnu.org; Fri, 20 Jan 2023 15:29:02 -0500 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 1pIy0N-0007r0-UT; Fri, 20 Jan 2023 15:28:55 -0500 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=/PPHXRULSd0xaYaICMlpCIJllPYtLvUxJEU/Z5QJcBs=; b=jk2sfL/xUv38 9bn6r5eCtj5sdSl45kc8KxjeWFdZsMjaAbaPWzeGiSr6emG6g20gPXUZHRUrjCrjeFBz3sCyxjieW ujTGUHcVmlBRarDYssnowez3XaiPsfCUQ1As9HXItvaCrnxYUe+dSlVh4eTaDNTXpunTkaDCkxLSN hyGoLPY5PGvJa6z6ccJrBSRo/nOOgTknVyQa+EouZDmsS6nC9phSNbXmjjAdmIVyO9TPLJz+2Phjw Zqpcf+zfOKE+hfmP7CVCe1jxJq15ysaw+4N+amrzrHPSHBYl4h04YbOSiuh8DZr7ZDbcc33GmCfWD 5ULEjkQ0eQvfr8jbrHW76A==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIy0M-0004iu-Ok; Fri, 20 Jan 2023 15:28:55 -0500 Date: Fri, 20 Jan 2023 22:28:55 +0200 Message-Id: <83ilh1lzlk.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87edrpklv3.fsf@thornhill.no> (message from Theodor Thornhill on Fri, 20 Jan 2023 21:10:56 +0100) Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode References: <87edrpklv3.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60972 Cc: 60972@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 (---) > Cc: eliz@gnu.org > From: Theodor Thornhill > Date: Fri, 20 Jan 2023 21:10:56 +0100 > > Attached is a ts-mode for HTML support. Thanks. > @Eli, is this ok for emacs-29, or should it go to master? If ok for 29 > I'll remove the sentence/sexp-related stuff and commit that later on > master. Otherwise I'll just add everything to master. Please install on master. But please also add setting of auto-mode-alist, similarly to what we do in other *-ts-mode's. And a NEWS entry. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 20 15:40:52 2023 Received: (at 60972) by debbugs.gnu.org; 20 Jan 2023 20:40:52 +0000 Received: from localhost ([127.0.0.1]:47261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIyBw-0007wQ-EN for submit@debbugs.gnu.org; Fri, 20 Jan 2023 15:40:52 -0500 Received: from out0.migadu.com ([94.23.1.103]:13243) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIyBv-0007wI-B9 for 60972@debbugs.gnu.org; Fri, 20 Jan 2023 15:40:51 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674247250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LEspMY1YtcQ5XwqC/riHN/Ue0XX/CygOrbHEPdzSUt0=; b=yp6WEC6MwaGBtHurhMmlgrcdPCV0TjtQnhQlOlCop0391bjcyylIxbLk3bplk65YJRBnz0 PpF8wjS3JWaTwNTzFc9kNpMHG13zY0k97MRe7XJSe/g9Zv86jvGt4eXfxshiSU0uGVp1oQ pn/G+gs3WinOaYzcbn+diCaVAYtV0YYC87RRMrjZwZ6eR7MtXq8pRWPZkm2gOGLiFbKOpa tKxgLl7L/d08iqpvDp0LCqICqoCOTcyWMJDngLwak80iwrciwZ6c1V0asx4VJ0xFpJ2CNz FkzbJ3upHBdJNARf40Nq9A32oYuGmwWcO7RMCWqKPzoiIwq929fp0SfYLRmqXA== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode In-Reply-To: <83ilh1lzlk.fsf@gnu.org> References: <87edrpklv3.fsf@thornhill.no> <83ilh1lzlk.fsf@gnu.org> Date: Fri, 20 Jan 2023 21:40:49 +0100 Message-ID: <877cxhkkha.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60972 Cc: 60972@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: -1.7 (-) Eli Zaretskii writes: >> Cc: eliz@gnu.org >> From: Theodor Thornhill >> Date: Fri, 20 Jan 2023 21:10:56 +0100 >> >> Attached is a ts-mode for HTML support. > > Thanks. > >> @Eli, is this ok for emacs-29, or should it go to master? If ok for 29 >> I'll remove the sentence/sexp-related stuff and commit that later on >> master. Otherwise I'll just add everything to master. > > Please install on master. Will do :) > > But please also add setting of auto-mode-alist, similarly to what we > do in other *-ts-mode's. And a NEWS entry. Will do! Theo From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 20 15:59:40 2023 Received: (at control) by debbugs.gnu.org; 20 Jan 2023 20:59:40 +0000 Received: from localhost ([127.0.0.1]:47275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIyU8-00005l-Jc for submit@debbugs.gnu.org; Fri, 20 Jan 2023 15:59:40 -0500 Received: from out0.migadu.com ([94.23.1.103]:21225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pIyU6-00005b-It for control@debbugs.gnu.org; Fri, 20 Jan 2023 15:59:39 -0500 Date: Fri, 20 Jan 2023 21:59:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674248377; h=from:from:reply-to:subject:subject:date:date:to:to:cc; bh=nVtiwxirwdiRxn+OzD4AdGARHt3x2dAu71z76qLkVAM=; b=FWkWTDqVCOZA6Eu7q22pnHhccyPQ3/0ZY6Go3Wx8+f+51IQKJ1QJu8+V7JJ5PYyCcAXseJ gO9zMqaMaCB5m+r7xachT20pR1cS/P4+FCUx5JQggs/zuljefTvzntGlDRlcU6XNo6DB8M hUSdwD7I/Pf2oUf1Vt6nONydQXsCePyxscBeCKHCVKFusx+MAyV1sF5PnqdZwMS98EmrzT FePHytWc0X52OLgpz3aAtr52hPQZHeVf2ZTWbDDttftmOlOxxORp/YlTR7QeRTLHWWTPcD ib2BluZsaBK7f9QVB2cFc6h6T3LiWl2hNJJZYaktOJoRwxU+bmZYGa8ElX9juw== To: control@debbugs.gnu.org X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill Subject: control message for bug #60972 X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: control 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" Message-Id: X-Spam-Score: -1.7 (-) close 60972 30.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 13:31:33 2023 Received: (at 60972) by debbugs.gnu.org; 21 Jan 2023 18:31:33 +0000 Received: from localhost ([127.0.0.1]:49721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJIeG-0002Pu-JP for submit@debbugs.gnu.org; Sat, 21 Jan 2023 13:31:33 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:46899) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJIdq-0002Ov-4z for 60972@debbugs.gnu.org; Sat, 21 Jan 2023 13:31:27 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 03CE1100002; Sat, 21 Jan 2023 18:30:44 +0000 (UTC) From: Juri Linkov To: Theodor Thornhill Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode In-Reply-To: <87edrpklv3.fsf@thornhill.no> (Theodor Thornhill via's message of "Fri, 20 Jan 2023 21:10:56 +0100") Organization: LINKOV.NET References: <87edrpklv3.fsf@thornhill.no> Date: Sat, 21 Jan 2023 19:50:18 +0200 Message-ID: <86o7qrg36l.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60972 Cc: 60972@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: -1.7 (-) > Attached is a ts-mode for HTML support. Thanks. Could you please clarify the difference between forward-sentence and forward-sexp in html-ts-mode. I expected that one of them is moving over the HTML tags and another over HTML elements. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 14:09:01 2023 Received: (at 60972) by debbugs.gnu.org; 21 Jan 2023 19:09:01 +0000 Received: from localhost ([127.0.0.1]:49790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJJEb-0003mG-Ec for submit@debbugs.gnu.org; Sat, 21 Jan 2023 14:09:01 -0500 Received: from out0.migadu.com ([94.23.1.103]:10374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJJEZ-0003m4-5O for 60972@debbugs.gnu.org; Sat, 21 Jan 2023 14:09:00 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674328137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fHKCS/hECBbjLA2f6epB0o9oz/fE4ultv1gib60hEVI=; b=ALCsun6tcp2CU4rr/4tVu/TPNEwnsAJCeCQ7Vd8Nzn4MY1N3OuJh7WIk819Wxu3A1K2hEo zGoC1vDD8+9UKTIXeK81otGlJg3gns4yWw/3OEhn2ZYM2LjCQCnaxuc+XqFAeC0IpY39ey Xzzu22mGRRqsJ0w/XZECQwlgWiKb2Ocifz+3+yWwKY+Tox461L3C1V0P0p9HI4T62YJrav rJSmusFyWMmPRVQ44plPzObJmd2b9uK2cjzCAPc2t/p94XHbYstNDBc1E0TYRffvAnrYfx DsEAd1ju/uqnYJ2NLGjcMlJnppofQ5qsu4bQJRxcF8hfo9sEkFICkUJUUojkEw== From: Theodor Thornhill To: Juri Linkov Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode In-Reply-To: <86o7qrg36l.fsf@mail.linkov.net> References: <87edrpklv3.fsf@thornhill.no> <86o7qrg36l.fsf@mail.linkov.net> Date: Sat, 21 Jan 2023 20:08:55 +0100 Message-ID: <87tu0j7liw.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60972 Cc: 60972@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: -1.7 (-) --=-=-= Content-Type: text/plain Juri Linkov writes: >> Attached is a ts-mode for HTML support. > > Thanks. Could you please clarify the difference between > forward-sentence and forward-sexp in html-ts-mode. > I expected that one of them is moving over the HTML tags > and another over HTML elements. Is this more like you were thinking? Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Use-element-as-a-sentence-in-html-ts-mode.patch >From a79b4f280c22e937a24f077f0aa7f5ea18a92a0c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 21 Jan 2023 20:05:52 +0100 Subject: [PATCH] Use element as a sentence in html-ts-mode * lisp/textmodes/html-ts-mode.el (html-ts-mode): Tweak the regexp. --- lisp/textmodes/html-ts-mode.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index 7e4360747a..a2d85bff7d 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -106,10 +106,7 @@ html-ts-mode (setq-local treesit-defun-name-function #'html-ts-mode--defun-name) - (setq-local treesit-sentence-type-regexp - (regexp-opt '("start_tag" - "self_closing_tag" - "end_tag"))) + (setq-local treesit-sentence-type-regexp "element") (setq-local treesit-sexp-type-regexp (regexp-opt '("tag" -- 2.34.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 22 12:13:53 2023 Received: (at 60972) by debbugs.gnu.org; 22 Jan 2023 17:13:53 +0000 Received: from localhost ([127.0.0.1]:52567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJduj-0005Yr-7b for submit@debbugs.gnu.org; Sun, 22 Jan 2023 12:13:53 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:40341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJdug-0005YR-4m for 60972@debbugs.gnu.org; Sun, 22 Jan 2023 12:13:52 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 03B4960006; Sun, 22 Jan 2023 17:13:41 +0000 (UTC) From: Juri Linkov To: Theodor Thornhill Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode In-Reply-To: <87tu0j7liw.fsf@thornhill.no> (Theodor Thornhill's message of "Sat, 21 Jan 2023 20:08:55 +0100") Organization: LINKOV.NET References: <87edrpklv3.fsf@thornhill.no> <86o7qrg36l.fsf@mail.linkov.net> <87tu0j7liw.fsf@thornhill.no> Date: Sun, 22 Jan 2023 19:02:15 +0200 Message-ID: <86lelu8yu8.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60972 Cc: 60972@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: -1.7 (-) >> I expected that one of them is moving over the HTML tags >> and another over HTML elements. > > Is this more like you were thinking? > > - (setq-local treesit-sentence-type-regexp > - (regexp-opt '("start_tag" > - "self_closing_tag" > - "end_tag"))) > + (setq-local treesit-sentence-type-regexp "element") According to the discussion in bug#60894 I expected it to be rather like this: (setq-local treesit-sentence-type-regexp "tag") (setq-local treesit-sexp-type-regexp (regexp-opt '("element" "text" "attribute" "value"))) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 22 13:20:08 2023 Received: (at 60972) by debbugs.gnu.org; 22 Jan 2023 18:20:08 +0000 Received: from localhost ([127.0.0.1]:52627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJewq-00018x-Ej for submit@debbugs.gnu.org; Sun, 22 Jan 2023 13:20:08 -0500 Received: from out2.migadu.com ([188.165.223.204]:63664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJewo-00018o-0E for 60972@debbugs.gnu.org; Sun, 22 Jan 2023 13:20:07 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674411604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xOP5MqJARuXX77NkxS2Q/v9j6jwwEWbD6a0iz3zJl6E=; b=kz4Gu1NVW+bGvowk8zZqhD+hw4Aw7uuC4Fum1Fg9ZYakoyNqXzcCV5QiwnDYpdl912OXim e2R2lFrn/sqrJkhSZTE9jEmydoOXXtm4FbF8qUG+jLUNzrVfQJ1M/r3W+swla43p6wE/dM 5WhmLSIkqQo/rbDiOut3erVfjiK1RoDrD5ZTw/1cyKLxpHza3nAslmY9y12h0gSAULh3RU a+OWbC8cs8cHzeATbWCiZAF3IjcS38xhr2ejf9XO/974HNw1D6Ed+0EVFJN/j3OCpRaOZ4 yCMPxQAw+fN6yeTRHWa1YMst+V55KJKrZkecVvIcnUhZp7ncUB7xinKkfc/A8w== From: Theodor Thornhill To: Juri Linkov Subject: Re: bug#60972: 30.0.50; [PATCH]: Add html-ts-mode In-Reply-To: <86lelu8yu8.fsf@mail.linkov.net> References: <87edrpklv3.fsf@thornhill.no> <86o7qrg36l.fsf@mail.linkov.net> <87tu0j7liw.fsf@thornhill.no> <86lelu8yu8.fsf@mail.linkov.net> Date: Sun, 22 Jan 2023 19:20:01 +0100 Message-ID: <87cz7677ou.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60972 Cc: 60972@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: -1.0 (-) Juri Linkov writes: >>> I expected that one of them is moving over the HTML tags >>> and another over HTML elements. >> >> Is this more like you were thinking? >> >> - (setq-local treesit-sentence-type-regexp >> - (regexp-opt '("start_tag" >> - "self_closing_tag" >> - "end_tag"))) >> + (setq-local treesit-sentence-type-regexp "element") > > According to the discussion in bug#60894 I expected it to be > rather like this: > > (setq-local treesit-sentence-type-regexp "tag") > (setq-local treesit-sexp-type-regexp > (regexp-opt '("element" > "text" > "attribute" > "value"))) Ok, let's try that :-) Theo From unknown Sun Aug 10 16:49:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 20 Feb 2023 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator