[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode c65d433a73 138/212: Improved indentation arou
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode c65d433a73 138/212: Improved indentation around multi-line function-calls |
Date: |
Wed, 26 Jan 2022 01:51:14 -0500 (EST) |
branch: externals/phps-mode
commit c65d433a73ee0632b2b5279cc95b4ab5e599a481
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Improved indentation around multi-line function-calls
---
phps-mode-indent.el | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 190bb38450..420e811238 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -1040,6 +1040,9 @@
;; return myFunction(
;; 'expression');
;; echo 'here';
+ ;; or
+ ;; define('_PRIVATE_ROOT_',
+ ;; 'here');
((and
previous-line-ends-with-terminus
(string= previous-line-ends-with-terminus ";")
@@ -1058,6 +1061,7 @@
(let ((not-found t)
(is-assignment nil)
(is-string-doc)
+ (is-function-call)
(parenthesis-level 0)
(is-bracket-less-command nil)
(is-same-line-p t)
@@ -1066,13 +1070,15 @@
(and
not-found
(search-backward-regexp
- "\\(;\\|{\\|(\\|)\\|=$\\|=[^>]\\|return\\|echo[\t
]+\\|print[\t ]+\\|\n\\|<<<'?\"?[a-zA-Z0-9_]+'?\"?\\)"
+ "\\(;\\|{\\|[a-zA-Z_]+[a-zA-Z0-9_]*[\t
]*(\\|)\\|=$\\|=[^>]\\|return\\|echo[\t ]+\\|print[\t
]+\\|\n\\|<<<'?\"?[a-zA-Z0-9_]+'?\"?\\)"
nil
t))
(let ((match (match-string-no-properties 0)))
(cond
+
((string= match "\n")
(setq is-same-line-p nil))
+
((string-match-p
"<<<'?\"?[a-zA-Z0-9_]+'?\"?"
match)
@@ -1082,14 +1088,26 @@
(setq
not-found
nil))
- ((string= match "(")
+
+ ((string-match-p
+ "[a-zA-Z_]+[a-zA-Z0-9_]*[\t ]*("
+ match)
(setq
parenthesis-level
- (1+ parenthesis-level)))
+ (1+ parenthesis-level))
+ (when (= parenthesis-level 0)
+ (setq
+ is-function-call
+ t)
+ (setq
+ not-found
+ nil)))
+
((string= match ")")
(setq
parenthesis-level
(1- parenthesis-level)))
+
((= parenthesis-level 0)
(setq is-assignment (string-match-p "=" match))
(setq is-bracket-less-command
@@ -1168,6 +1186,14 @@
new-indentation
(- new-indentation tab-width)))
+ ;; define('_PRIVATE_ROOT',
+ ;; 'here');
+ ;; echo 'here';
+ (when is-function-call
+ (setq
+ new-indentation
+ (- new-indentation tab-width)))
+
)
(goto-char point))
- [elpa] externals/phps-mode 6cb18913e4 152/212: Improved indentation for lines ending with closing bracket and comma, (continued)
- [elpa] externals/phps-mode 6cb18913e4 152/212: Improved indentation for lines ending with closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 26d7b64086 144/212: Added TODO item for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0e7eb04800 149/212: Passing indentation test for multiple function arguments with default values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2e16122284 153/212: Improved indentation on line after closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1825ee499b 151/212: More wrestling with indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 29fee20e43 141/212: Passed all tests for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6a49784b8b 161/212: When indentation search previous code lines it skips commented out lines, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5432a61340 162/212: Improved indentation around closing of multi-dimensional brackets, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 28a5302e08 148/212: Passing indentation on line after closing bracket and command and were current line starts with closing bracket, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode be61c94dc3 165/212: Added TODO item, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c65d433a73 138/212: Improved indentation around multi-line function-calls,
Christian Johansson <=
- [elpa] externals/phps-mode f537965850 168/212: Improved indentation on lines after lines that ends with semicolon, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6d8544d7fa 171/212: Added two more failing tests for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 616e3dc7ea 172/212: Added a TODO file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d74686e07c 180/212: Started on optimizing lexer, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 06b35e4bf1 183/212: Fixed TODO item in this branch, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 40ecf58372 189/212: Adjustments for indent helper function determining last index line, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode edba476df8 191/212: Byte compilation fixes for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 580298c395 201/212: Improved indentation of multi-line concatenated strings containing brackets, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3e79319cf5 195/212: Added failing indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 72c692b511 210/212: Re-scan buffer interactively now clears cache and kills running threads, Christian Johansson, 2022/01/26