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

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

[elpa] externals/phps-mode cc77604 284/405: Fixed bug with indentation a


From: Stefan Monnier
Subject: [elpa] externals/phps-mode cc77604 284/405: Fixed bug with indentation after switch case statements
Date: Sat, 13 Jul 2019 10:00:33 -0400 (EDT)

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

    Fixed bug with indentation after switch case statements
---
 phps-mode-functions.el      | 15 ++++++++++++++-
 phps-mode-test-functions.el |  2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 72be62d..9e31d71 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -305,6 +305,7 @@
                       (message "Ended switch curly stack at %s" 
curly-bracket-level))
 
                     (setq allow-custom-column-decrement t)
+                    (pop nesting-stack)
                     (setq alternative-control-structure-level (1- 
alternative-control-structure-level))
                     (pop switch-curly-stack))
                   
@@ -329,6 +330,7 @@
                     (pop switch-alternative-stack)
                     (pop switch-case-alternative-stack)
                     (setq allow-custom-column-decrement t)
+                    (pop nesting-stack)
                     (setq alternative-control-structure-level (1- 
alternative-control-structure-level)))
 
                   (when first-token-on-line
@@ -473,6 +475,9 @@
                   (push alternative-control-structure-level 
switch-case-alternative-stack)))
 
               (when token
+
+                (when phps-mode-functions-verbose
+                  (message "Processing token: %s" token))
                 
                 ;; Calculate nesting
                 (setq nesting-end (+ round-bracket-level square-bracket-level 
curly-bracket-level alternative-control-structure-level in-assignment-level 
in-class-declaration-level concatenation-level))
@@ -500,20 +505,28 @@
                         ;; Decrement column
                         (if allow-custom-column-decrement
                             (progn
+                              (when phps-mode-functions-verbose
+                                (message "Doing custom decrement 1 from %s to 
%s" column-level (- column-level (- nesting-start nesting-end))))
                               (setq column-level (- column-level (- 
nesting-start nesting-end)))
                               (setq allow-custom-column-decrement nil))
+                          (when phps-mode-functions-verbose
+                            (message "Doing regular decrement 1 from %s to %s" 
column-level (1- column-level)))
                           (setq column-level (1- column-level)))
 
                         ;; Prevent negative column-values
                         (when (< column-level 0)
                           (setq column-level 0)))
 
-                    (when (not temp-post-indent)
+                    (unless temp-post-indent
+                      (when phps-mode-functions-verbose
+                        (message "Temporary setting post indent %s" 
column-level))
                       (setq temp-post-indent column-level))
 
                     ;; Decrement column
                     (if allow-custom-column-decrement
                         (progn
+                          (when phps-mode-functions-verbose
+                                (message "Doing custom decrement 2 from %s to 
%s" column-level (- column-level (- nesting-start nesting-end))))
                           (setq temp-post-indent (- temp-post-indent (- 
nesting-start nesting-end)))
                           (setq allow-custom-column-decrement nil))
                       (setq temp-post-indent (1- temp-post-indent)))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 815ff60..cdee03d 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -632,7 +632,7 @@
 (defun phps-mode-test-functions ()
   "Run test for functions."
   ;; (setq debug-on-error t)
-  (setq phps-mode-functions-verbose t)
+  ;; (setq phps-mode-functions-verbose t)
   (phps-mode-test-functions-get-lines-lindent-if)
   (phps-mode-test-functions-get-lines-indent-classes)
   (phps-mode-test-functions-get-lines-indent-inline-if)



reply via email to

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