emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/php-mode 31220ab874 2/3: Fix #726 indentation


From: ELPA Syncer
Subject: [nongnu] elpa/php-mode 31220ab874 2/3: Fix #726 indentation
Date: Sun, 5 Mar 2023 16:59:40 -0500 (EST)

branch: elpa/php-mode
commit 31220ab874be6faa796a2072c64a903e4f86854d
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>

    Fix #726 indentation
---
 CHANGELOG.md               | 10 ++++++++--
 lisp/php-mode.el           |  3 ++-
 tests/indent/issue-726.php | 13 +++++++++++++
 tests/php-mode-test.el     |  3 ++-
 4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fa4eb4c87..de0f8d111b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,17 +6,23 @@ All notable changes of the PHP Mode 1.19.1 release series are 
documented in this
 
 ### Added
 
- * **Net feature**: `php-format` ([#730])
+ * **Net feature**: `php-format` ([#731])
    * Add `php-format-project` and `php-format-this-buffer-file` commands
    * Add `php-format-auto-mode` minor mode
 
+### Fixed
+
+ * Fix array indentation broken by commenting out ([#726], [#732])
+
 ### Removed
 
  * No longer highlights `'link` in PHPDoc ([#724])
    * Please use `goto-address-prog-mode` minor mode
 
 [#724]: https://github.com/emacs-php/php-mode/pull/724
-[#730]: https://github.com/emacs-php/php-mode/pull/730
+[#726]: https://github.com/emacs-php/php-mode/pull/726
+[#731]: https://github.com/emacs-php/php-mode/pull/731
+[#732]: https://github.com/emacs-php/php-mode/pull/732
 
 ## [1.24.2] - 2022-11-13
 
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 319e1d2a4b..012f21ee29 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -663,6 +663,7 @@ but only if the setting is enabled."
          ((looking-at-p "->") '+)
          ((looking-at-p "[:?]") '+)
          ((looking-at-p "[,;]") nil)
+         ((looking-at-p "//") nil)
          ;; Is the previous line terminated with `,' ?
          ((progn
             (forward-line -1)
@@ -672,7 +673,7 @@ but only if the setting is enabled."
             (while (and (< beginning-of-langelem (point))
                         (setq start (php-in-string-or-comment-p)))
               (goto-char start)
-              (skip-chars-backward "   ")
+              (skip-chars-backward "   \r\n")
               (backward-char 1))
             (and (not (eq (point) beginning-of-current-line))
                  (not (looking-at-p ","))
diff --git a/tests/indent/issue-726.php b/tests/indent/issue-726.php
new file mode 100644
index 0000000000..b48c6f0481
--- /dev/null
+++ b/tests/indent/issue-726.php
@@ -0,0 +1,13 @@
+<?php
+$a = [
+    'aaa' => [
+        'bee' => 2,
+    ],
+    // 'foo' => [
+    //      'bar' => 1,
+    // ],
+    // ###php-mode-test### ((indent 4))
+    'lee' => 2,
+    // 'dee' => 3
+    'gee' => 4, // ###php-mode-test### ((indent 4))
+]; // ###php-mode-test### ((indent 0))
diff --git a/tests/php-mode-test.el b/tests/php-mode-test.el
index 79db0b8a1b..0dae822e95 100644
--- a/tests/php-mode-test.el
+++ b/tests/php-mode-test.el
@@ -652,7 +652,8 @@ Meant for `php-mode-test-issue-503'."
 
 (ert-deftest php-mode-test-issue-702 ()
   "Proper alignment arglist."
-  (with-php-mode-test ("indent/issue-702.php" :indent t :magic t)))
+  (with-php-mode-test ("indent/issue-702.php" :indent t :magic t))
+  (with-php-mode-test ("indent/issue-726.php" :indent t :magic t)))
 
 (ert-deftest php-mode-test-php74 ()
   "Test highlighting language constructs added in PHP 7.4."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]