From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincenzo Pupillo Newsgroups: gmane.emacs.bugs Subject: bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax. Date: Fri, 21 Jun 2024 23:46:15 +0200 Message-ID: <2765503.vuYhMxLoTh@fedora> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4940842.OV4Wx5bFTl" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14724"; mail-complaints-to="usenet@ciao.gmane.io" To: 71710@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 21 23:49:39 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sKm8Z-0003aC-KV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Jun 2024 23:49:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKm82-0006M0-5j; Fri, 21 Jun 2024 17:49:06 -0400 Original-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 1sKm7z-0006LC-Kv for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2024 17:49:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKm7z-0002Eg-Cc for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2024 17:49:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKm7y-0006RC-L6 for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2024 17:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Jun 2024 21:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71710 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171900651624713 (code B ref -1); Fri, 21 Jun 2024 21:49:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jun 2024 21:48:36 +0000 Original-Received: from localhost ([127.0.0.1]:43947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKm7Y-0006QW-B6 for submit@debbugs.gnu.org; Fri, 21 Jun 2024 17:48:36 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKm7S-0006QE-Sf for submit@debbugs.gnu.org; Fri, 21 Jun 2024 17:48:31 -0400 Original-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 1sKm5N-0005zq-Dr for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2024 17:46:21 -0400 Original-Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKm5L-0001aX-NV for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2024 17:46:21 -0400 Original-Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a6f1da33826so312351266b.0 for ; Fri, 21 Jun 2024 14:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719006378; x=1719611178; 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=kEGlNfen7kkjcZa4LPv8qff1f5aUHdHrJ+jvazPuYQg=; b=K9gLRHo7hyQ2WecWv5CQJM9y2VLDJ+4yDdwwPV1JhHnvknOQ/bZ7RNBO0e83RBJziO t1YbYBnxTjD0ornHkx+dAn2k/XwB+YuUT0QfSskG9okDcQZQ5bQlzoTHP64s9kseXzxk JziOYDWCB1+CMDnkw2E33WfT6B5QrjpJaMp6tK33084JxE9qs3RTUiRCok2OECqzm0iL Gs2BaUt3aZyziluDa57H0JxoIrQN64bqjS1MZi4on1DIrX50MfWIgBZ7tjxwu244xXNj 6fWGJJDMzmA4IkpO5rzQmdPqVH2+CvPGIpmXbFtW8mUa7jHkZSDNKS3B6uWM5W2VbT38 VPRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719006378; x=1719611178; 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=kEGlNfen7kkjcZa4LPv8qff1f5aUHdHrJ+jvazPuYQg=; b=OLUXOTGpDv9cXyY0q5q7RnkjzKva64z9ztfPhVCm56vibk9ZP1IIQbcIqgC6rWNmoi 2A5NvhirnHpS6zZevKNJkkPso4LyKn5E5Z8AWB34h8wf+rt7sqli0EUqQ5CbLRDuigfP vGvBjUbactRK5/U0m8yoi35wgDo722qwkC5W/3U/IXCDXWrhW3umnuvN3ySeCoaN2kcV P5spbe22nqv7IamXXfFE7w09f94Zqf5rIuUjg5VQ3jnuwSYiLp98L6AxUPvytLJj/CSw UQM/wk7bzD0xj2i8p+84vtHUXC+5sZ2pxhWG6DZUZitIM8bhjnZHud3Q5LrdvnnbLSck StOA== X-Gm-Message-State: AOJu0Yzl7FAQ1xyJ1C/jXRSnf/OXxpI9FiTLRqvsQuZMpwU7LbtviRL/ 2hYjk9Dwa3zxzHuHvHFB7jloZibON06ZSPe2P5hd0zNvzgXJLJuLcjooMxms X-Google-Smtp-Source: AGHT+IGQDziZqZZtIMac93UhR1ypDzk1J7KpJeOPtcBbirPyWjoaM1Awim9+aPxeiymqcihQ50rvXg== X-Received: by 2002:a17:907:c086:b0:a6f:b687:1ee3 with SMTP id a640c23a62f3a-a6fb687211dmr657583566b.1.1719006377418; Fri, 21 Jun 2024 14:46:17 -0700 (PDT) Original-Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf9baf31sm121060666b.3.2024.06.21.14.46.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 14:46:17 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=v.pupillo@gmail.com; helo=mail-ej1-x631.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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287641 Archived-At: This is a multi-part message in MIME format. --nextPart4940842.OV4Wx5bFTl Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Hi, The attached patch fixes the indentation of PHP's "alternative syntax for control structure". https://www.php.net/manual/en/control-structures.alternative-syntax.php Thanks. Vincenzo GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-06-21 --nextPart4940842.OV4Wx5bFTl Content-Disposition: attachment; filename="0001-Support-for-indentation-of-PHP-alternative-syntax-co.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Support-for-indentation-of-PHP-alternative-syntax-co.patch" >From 45f6c668bdf0b88227db8de3576a2c6408966c49 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Fri, 21 Jun 2024 23:24:33 +0200 Subject: [PATCH] Support for indentation of PHP alternative syntax control structures For some control structures, PHP provides an alternative syntax. A new rule has been added to handle this syntax. * lisp/progmodes/php-ts-mode.el (php-ts-mode--indent-styles): New rule for PHP alternative syntax. --- lisp/progmodes/php-ts-mode.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 8bb18dab3d5..415ba695158 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -651,6 +651,12 @@ php-ts-mode--indent-styles ;; These rules are for cases where the body is bracketless. ((match "while" "do_statement") parent-bol 0) + ;; rule for PHP alternative syntax + ((or (node-is "else_if_clause") + (node-is "endif") + (node-is "endforeach") + (node-is "endwhile")) + parent-bol 0) ((or (parent-is "if_statement") (parent-is "else_clause") (parent-is "for_statement") -- 2.45.2 --nextPart4940842.OV4Wx5bFTl--