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

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

[elpa] externals/phps-mode 47440dd 036/405: Added test for decreasing in


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 47440dd 036/405: Added test for decreasing indentation with letters
Date: Sat, 13 Jul 2019 09:59:35 -0400 (EDT)

branch: externals/phps-mode
commit 47440ddc6c74a161c7de015bd3132e59a4b9d672
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added test for decreasing indentation with letters
---
 phps-functions.el      | 3 ++-
 phps-test-functions.el | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/phps-functions.el b/phps-functions.el
index 1d26588..cc2bc7a 100644
--- a/phps-functions.el
+++ b/phps-functions.el
@@ -50,7 +50,8 @@
             (let* ((indent-start (* (+ (nth 1 start) (nth 2 start)) 4))
                    (indent-end (* (+ (nth 1 end) (nth 2 end)) 4))
                    (indent-diff 0))
-              (when (> indent-start indent-end)
+              (when (and (> indent-start indent-end)
+                         (looking-at-p "^[][ \t)(}{};]+\\($\\|?>\\)"))
                 (setq indent-diff (- indent-start indent-end)))
               (setq indent-level (- indent-start indent-diff))
               (message "inside scripting, start: %s, end: %s, indenting to 
column %s " start end indent-level)
diff --git a/phps-test-functions.el b/phps-test-functions.el
index f5f637f..3f6543e 100644
--- a/phps-test-functions.el
+++ b/phps-test-functions.el
@@ -81,13 +81,20 @@
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random'\n);\n$variable = true;\n"))))
 
-(phps-mode/with-test-buffer
+  (phps-mode/with-test-buffer
    "<?php\n$variable = array(\n    'random'\n    );\n$variable = true;\n"
    (goto-char 39)
    (phps-mode/indent-line)
    (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
      (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random'\n);\n$variable = true;\n"))))
 
+  (phps-mode/with-test-buffer
+   "<?php\n$variable = array(\n'random');\n$variable = true;\n"
+   (goto-char 29)
+   (phps-mode/indent-line)
+   (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
+     (should (equal buffer-contents  "<?php\n$variable = array(\n    
'random');\n$variable = true;\n"))))
+
   )
 
 (defun phps-mod/test-functions ()



reply via email to

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