all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

* bug#71710: 30.0.50; [PATCH] php-ts-mode: new rule to indent php alternative syntax.
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-06-22  9:43 UTC (permalink / raw)
  To: Vincenzo Pupillo; +Cc: 71710-done

> From: Vincenzo Pupillo <v.pupillo@gmail.com>
> Date: Fri, 21 Jun 2024 23:46:15 +0200
> 
> 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, installed, and closing the bug.





^ permalink raw reply	[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 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.