From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: 71710@debbugs.gnu.org
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 [thread overview]
Message-ID: <2765503.vuYhMxLoTh@fedora> (raw)
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
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
[-- Attachment #2: 0001-Support-for-indentation-of-PHP-alternative-syntax-co.patch --]
[-- Type: text/x-patch, Size: 1279 bytes --]
From 45f6c668bdf0b88227db8de3576a2c6408966c49 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <v.pupillo@gmail.com>
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
next reply other threads:[~2024-06-21 21:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 21:46 Vincenzo Pupillo [this message]
2024-06-22 9:43 ` bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2765503.vuYhMxLoTh@fedora \
--to=v.pupillo@gmail.com \
--cc=71710@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.