[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 7e755e1 303/405: Fixed indentation for argume
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 7e755e1 303/405: Fixed indentation for argument assignments |
Date: |
Sat, 13 Jul 2019 10:00:37 -0400 (EDT) |
branch: externals/phps-mode
commit 7e755e15a414b16304c5c4100c747318441bced9
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Fixed indentation for argument assignments
---
phps-mode-functions.el | 76 ++++++++++++++++++++++++++------------------------
1 file changed, 39 insertions(+), 37 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 54f1fa4..e9e54ec 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -524,51 +524,53 @@
;; Has nesting increased?
(when (and nesting-stack
(<= nesting-end (car (car nesting-stack))))
+ (let ((nesting-decrement 0))
- ;; TODO Handle case were nesting has decreased less than
next as well
-
- (when phps-mode-functions-verbose
- (message "\nPopping %s from nesting-stack since %s is
lesser or equal to %s, next value is: %s\n" (car nesting-stack) nesting-end
(car (car nesting-stack)) (nth 1 nesting-stack))
- )
- (pop nesting-stack)
+ ;; Handle case were nesting has decreased less than next
as well
+ (while (and nesting-stack
+ (<= nesting-end (car (car nesting-stack))))
+ (when phps-mode-functions-verbose
+ (message "\nPopping %s from nesting-stack since %s is
lesser or equal to %s, next value is: %s\n" (car nesting-stack) nesting-end
(car (car nesting-stack)) (nth 1 nesting-stack)))
+ (pop nesting-stack)
+ (setq nesting-decrement (1+ nesting-decrement)))
- (if first-token-is-nesting-decrease
+ (if first-token-is-nesting-decrease
- (progn
- ;; 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)))
+ (progn
+ ;; 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 (- column-level
nesting-decrement)))
- ;; Prevent negative column-values
- (when (< column-level 0)
- (setq column-level 0)))
+ ;; Prevent negative column-values
+ (when (< column-level 0)
+ (setq column-level 0)))
- (unless temp-post-indent
- (when phps-mode-functions-verbose
- (message "Temporary setting post indent %s"
column-level))
- (setq temp-post-indent column-level))
+ (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)))
+ ;; 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 (- temp-post-indent
nesting-decrement)))
- ;; Prevent negative column-values
- (when (< temp-post-indent 0)
- (setq temp-post-indent 0))
+ ;; Prevent negative column-values
+ (when (< temp-post-indent 0)
+ (setq temp-post-indent 0))
- ))
+ )))
;; Are we on a new line or is it the last token of the buffer?
(if (> next-token-start-line-number token-start-line-number)
- [elpa] externals/phps-mode 20199b0 307/405: Added byte-compiled Lisp to gitignore, (continued)
- [elpa] externals/phps-mode 20199b0 307/405: Added byte-compiled Lisp to gitignore, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a0b7695 316/405: Passes unit tests for integration with electric-pair, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7c3a31a 305/405: Fixed bug in indentation with stacked assignment closures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 68422f5 301/405: Restored indentation test for PSR-2 closure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f3766db 310/405: Fixed byte-compilation in lexer and integration-tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2ec6f6d 306/405: Fixed some compilation warnings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f2fe751 302/405: More work on trying to get PSR-2 indentation working, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8eb3dc0 311/405: Fixed byte-compilation issue in lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f77edf8 308/405: Updated compile command to ignore that files that doesn't compile, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5d5ec06 313/405: Started on test for automatic quotations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e755e1 303/405: Fixed indentation for argument assignments,
Stefan Monnier <=
- [elpa] externals/phps-mode a852669 320/405: Fix bug in syntax colouring, added debug outputs for incremental lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad94b0b 319/405: Removed some fixed TODO itemsc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2427c7e 318/405: Improved README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6d834c1 312/405: Added support for (comment-region) and (uncomment-region), Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b1d2820 309/405: Fixed issue with indentation of square bracket arrays in assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3bc2411 317/405: Moved syntax-table tests to own file, using local electric-pair-mode in PHPs buffers, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2b8a16 335/405: Passes new test for concatenated string inside function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b4e416a 336/405: (comment-region) tests working with custom function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad53b6c 330/405: Fixed warning when expected integer was nil, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c8c5b62 337/405: Made custom functions for (comment-region) and (uncomment-region), Stefan Monnier, 2019/07/13