From unknown Tue Sep 23 13:42:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60169: 30.0.50; [PATCH]: Simplify jsx/tsx rules for indentation Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: casouri@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 22:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60169 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 60169@debbugs.gnu.org Cc: casouri@gmail.com X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.16713152579173 (code B ref -1); Sat, 17 Dec 2022 22:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 22:14:17 +0000 Received: from localhost ([127.0.0.1]:58241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fRh-0002Nt-4t for submit@debbugs.gnu.org; Sat, 17 Dec 2022 17:14:17 -0500 Received: from lists.gnu.org ([209.51.188.17]:46980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fRf-0002Nn-Ke for submit@debbugs.gnu.org; Sat, 17 Dec 2022 17:14:16 -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 1p6fRf-0003In-FF for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:14:15 -0500 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6fRd-0007XC-HL for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:14:15 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill Date: Sat, 17 Dec 2022 23:14:08 +0100 Message-ID: <87wn6psmof.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, 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-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 Yuan! Can you install this for me? Thanks in advance, Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Indentation-fixes-for-jsx-tsx.patch >From ef710150559b2e865d918024edb6beea46d290b3 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 17 Dec 2022 23:11:57 +0100 Subject: [PATCH] Indentation fixes for jsx/tsx * lisp/progmodes/js.el (js--treesit-indent-rules): Simplify the rules. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Simplify the rules --- lisp/progmodes/js.el | 11 +++++------ lisp/progmodes/typescript-ts-mode.el | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a776ff91f9..8c1ee495c2 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3451,14 +3451,13 @@ js--treesit-indent-rules ((parent-is "statement_block") parent-bol js-indent-level) ;; JSX - ((parent-is "jsx_opening_element") parent js-indent-level) - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent js-indent-level) + ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((node-is "jsx_text") parent js-indent-level) - ((parent-is "jsx_element") parent js-indent-level) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent js-indent-level))))) + ((node-is ">") parent 0))))) (defvar js--treesit-keywords '("as" "async" "await" "break" "case" "catch" "class" "const" "continue" diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index e7bd65c5e2..890d0a8134 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -95,13 +95,13 @@ typescript-ts-mode--indent-rules ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) ,@(when (eq language 'tsx) - `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + `(((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + ((node-is ">") parent 0))) (no-node parent-bol 0)))) (defvar typescript-ts-mode--keywords -- 2.34.1 --=-=-=-- From unknown Tue Sep 23 13:42:30 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: Theodor Thornhill Subject: bug#60169: closed (Re: bug#60169: 30.0.50; [PATCH]: Simplify jsx/tsx rules for indentation) Message-ID: References: <8C6BAF49-E43C-4509-94A8-1D289B8063BF@gmail.com> <87wn6psmof.fsf@thornhill.no> X-Gnu-PR-Message: they-closed 60169 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 60169@debbugs.gnu.org Date: Sat, 17 Dec 2022 23:37:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1671320222-12900-1" This is a multi-part message in MIME format... ------------=_1671320222-12900-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #60169: 30.0.50; [PATCH]: Simplify jsx/tsx rules for indentation 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 60169@debbugs.gnu.org. --=20 60169: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60169 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1671320222-12900-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 60169-done) by debbugs.gnu.org; 17 Dec 2022 23:36:35 +0000 Received: from localhost ([127.0.0.1]:58602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6gjK-0003Lj-VW for submit@debbugs.gnu.org; Sat, 17 Dec 2022 18:36:35 -0500 Received: from mail-pl1-f177.google.com ([209.85.214.177]:33642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6gjJ-0003Lb-UU for 60169-done@debbugs.gnu.org; Sat, 17 Dec 2022 18:36:34 -0500 Received: by mail-pl1-f177.google.com with SMTP id 17so5779536pll.0 for <60169-done@debbugs.gnu.org>; Sat, 17 Dec 2022 15:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=QpiW8QP4HnVEKK29uUwO6OtUV+ZU2lgzOAhUfVS4RXw=; b=RNDeechRJRXohZ5t9PqxBBJEldfkzeWjBFdE9u+lx38mbpwxbMrBiqOtLbKppb3SqI v4Vf4P/baWDhf/PLcUXPhcjMf6zgTt0jsm+ZCZdaBw6CBeTKu64USXf+gGcJ1TirgwPX G/JJBhD2D473JoxifceG9JcmedraaFZ5UtqmdFXdldhJpTmL+XGcTFsseoZz+xqq97he Po02/VZuEP1biM4v7bDs7QQ/r1ZcF7IARZBsKZliap/csOZrKWQrkvvcNcyRGIZjTx4Q OBFed7zvAUjYx0LkPipxe2BCf1dvQJc/ik/pBaBkGmFcLUk6sakESs4Kd3N3nU5gFEOk favA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QpiW8QP4HnVEKK29uUwO6OtUV+ZU2lgzOAhUfVS4RXw=; b=VFVVG7J1Jhueq1tIHEluXtC17LHJeT2qNQvLgLDRJHuYKtLfetYyfePjedQTpMqRX7 ChMmPXhF7hu0H1Xi/9u8xNlU0ixPscgV+lvuiRKVsw/Tn2qFbjknrMX0OZiwDv+RBaFI EWRTTJGDCGMnZbIcDIfxG8ufDSyMMaTM1QmN6BfUvFo0gf7tcZ7GO30f+Ln9M2KjFGVt dlvOps4BxWtBXuf49Z5xqKzKK119OG/xFPfQV5yA8ZHHx8mdrCKN/AzU97xbe5wiredI LQUBRQ0FnGxtWPek+xAUVI3Yfrb7tCIwGKvllhuogillim3dMtNHDcN/QTXfbApHjnB2 RE/w== X-Gm-Message-State: ANoB5pksI2u2T37xO45aewqRoO3WILuMFMQQeLnXXCzJCCkPyFJ11hQF VVnZMO3ec0lAh26Z3P6O4M8= X-Google-Smtp-Source: AA0mqf59wAw8jpPIY6ymog77ePGxiDxC3aYxljfrx2E9i7E8T0dkMZhPEMURjYCu93p4IjoG9RbLZA== X-Received: by 2002:a17:90b:916:b0:219:bd2b:e2c1 with SMTP id bo22-20020a17090b091600b00219bd2be2c1mr39409693pjb.9.1671320188127; Sat, 17 Dec 2022 15:36:28 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id f61-20020a17090a704300b00218fb211778sm6813261pjk.41.2022.12.17.15.36.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Dec 2022 15:36:27 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#60169: 30.0.50; [PATCH]: Simplify jsx/tsx rules for indentation Message-Id: <8C6BAF49-E43C-4509-94A8-1D289B8063BF@gmail.com> Date: Sat, 17 Dec 2022 15:36:26 -0800 To: Theodor Thornhill X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60169-done Cc: 60169-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: -1.0 (-) Theodor Thornhill writes: > Hi Yuan! > > Can you install this for me? > > Thanks in advance, > Theo Applied, thanks! Yuan ------------=_1671320222-12900-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 22:14:17 +0000 Received: from localhost ([127.0.0.1]:58241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fRh-0002Nt-4t for submit@debbugs.gnu.org; Sat, 17 Dec 2022 17:14:17 -0500 Received: from lists.gnu.org ([209.51.188.17]:46980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fRf-0002Nn-Ke for submit@debbugs.gnu.org; Sat, 17 Dec 2022 17:14:16 -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 1p6fRf-0003In-FF for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:14:15 -0500 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6fRd-0007XC-HL for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:14:15 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: bug-gnu-emacs@gnu.org Subject: 30.0.50; [PATCH]: Simplify jsx/tsx rules for indentation X-Debbugs-Cc: casouri@gmail.com Date: Sat, 17 Dec 2022 23:14:08 +0100 Message-ID: <87wn6psmof.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, 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 Yuan! Can you install this for me? Thanks in advance, Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Indentation-fixes-for-jsx-tsx.patch >From ef710150559b2e865d918024edb6beea46d290b3 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 17 Dec 2022 23:11:57 +0100 Subject: [PATCH] Indentation fixes for jsx/tsx * lisp/progmodes/js.el (js--treesit-indent-rules): Simplify the rules. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Simplify the rules --- lisp/progmodes/js.el | 11 +++++------ lisp/progmodes/typescript-ts-mode.el | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a776ff91f9..8c1ee495c2 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3451,14 +3451,13 @@ js--treesit-indent-rules ((parent-is "statement_block") parent-bol js-indent-level) ;; JSX - ((parent-is "jsx_opening_element") parent js-indent-level) - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent js-indent-level) + ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((node-is "jsx_text") parent js-indent-level) - ((parent-is "jsx_element") parent js-indent-level) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent js-indent-level))))) + ((node-is ">") parent 0))))) (defvar js--treesit-keywords '("as" "async" "await" "break" "case" "catch" "class" "const" "continue" diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index e7bd65c5e2..890d0a8134 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -95,13 +95,13 @@ typescript-ts-mode--indent-rules ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) ,@(when (eq language 'tsx) - `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + `(((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) + ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + ((node-is ">") parent 0))) (no-node parent-bol 0)))) (defvar typescript-ts-mode--keywords -- 2.34.1 --=-=-=-- ------------=_1671320222-12900-1--