* bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.
@ 2024-06-21 21:46 Vincenzo Pupillo
2024-06-22 9:43 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Vincenzo Pupillo @ 2024-06-21 21:46 UTC (permalink / raw)
To: 71710
[-- 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-22 9:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21 21:46 bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax Vincenzo Pupillo
2024-06-22 9:43 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).