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

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

[elpa] externals/phps-mode dece7f242e 160/212: Added more failing indent


From: Christian Johansson
Subject: [elpa] externals/phps-mode dece7f242e 160/212: Added more failing indentation tests
Date: Wed, 26 Jan 2022 01:51:19 -0500 (EST)

branch: externals/phps-mode
commit dece7f242e6a6aafbba50a43739f8d8db19a1fe7
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Added more failing indentation tests
---
 phps-mode-indent.el           | 17 +++++++++++++++--
 test/phps-mode-test-indent.el |  4 ++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index b3d4c378b1..36ba5ee371 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -249,6 +249,7 @@
 
               ;; (message "current-line-starts-with-closing-bracket: %S" 
current-line-starts-with-closing-bracket)
               ;; (message "current-line-starts-with-opening-bracket: %S" 
current-line-starts-with-opening-bracket)
+              ;; (message "previous-line-ends-with-closing-bracket: %S" 
previous-line-ends-with-closing-bracket)
               ;; (message "previous-line-ends-with-opening-bracket: %S" 
previous-line-ends-with-opening-bracket)
               ;; (message "previous-line-ends-with-terminus: %S" 
previous-line-ends-with-terminus)
               ;; (message "previous-bracket-level: %S" previous-bracket-level)
@@ -259,6 +260,17 @@
 
               (cond
 
+               ;; // die(
+               ;; echo 'here';
+               ((string-match-p
+                 "^[\t ]*//"
+                 previous-line-string)
+                (when current-line-starts-with-closing-bracket
+                  (setq
+                   new-indentation
+                   (- new-indentation tab-width))
+                  ))
+
                ;; class MyClass implements
                ;;     myInterface
                ;; or
@@ -967,10 +979,11 @@
                           (and
                            not-found-command-start
                            (search-backward-regexp
-                            "\\(;\\|}\\|{\\|[\t ]*[^\t ]+[\t ]*$\\)"
+                            "\\(;\\|}\\|{\\|^[\t ]*[^\t\n ]+[\t ]*$\\)"
                             nil
                             t))
-                        (let ((match (match-string-no-properties 0)))
+                        (let ((match (match-string-no-properties 1)))
+                          ;; (message "match: %S" match)
                           (cond
 
                            ;; End of expression / statement
diff --git a/test/phps-mode-test-indent.el b/test/phps-mode-test-indent.el
index a3e3423504..6b1553b561 100644
--- a/test/phps-mode-test-indent.el
+++ b/test/phps-mode-test-indent.el
@@ -188,6 +188,10 @@
    "<?php\n$options = myFunction(\n    array(array(\n        'options' => 
123\n    ))\n);"
    "Assignment with double-dimensional array with double arrow assignment 
inside function call")
 
+  (phps-mode-test-indent--should-equal
+   "<?php\n// die('debug: ' . $debug\nif ($debug) {\n    \n}\n"
+   "Line after commented out opening bracket line")
+
   (phps-mode-test-indent--should-equal
    "<?php\nswitch ($condition) {\n    case 34:\n        if ($item['Random'] % 
10 == 0) {\n            $attributes['item'] = ($item['IntegerValue'] / 10);\n   
     } else {\n            $attributes['item'] =\n                
number_format(($item['IntegerValue'] / 10), 1, '.', '');\n        }\n        
break;\n}\n"
    "Switch case with conditional modulo expression")



reply via email to

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