branch: externals/phps-mode commit 87974abfccba4c1ea806c0696a5a52c59ef3ab32 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Improved indentation after lines containing => symbol --- phps-mode-indent.el | 28 +++++++++++++++++++++------- phps-mode-macros.el | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/phps-mode-indent.el b/phps-mode-indent.el index ade1f7d914..eb2db11d40 100644 --- a/phps-mode-indent.el +++ b/phps-mode-indent.el @@ -1014,7 +1014,7 @@ (phps-mode-indent--get-previous-reference-index-line))) (if reference-line (progn - (message "reference-line-2: %S" reference-line) + ;; (message "reference-line-2: %S" reference-line) (setq new-indentation (phps-mode-indent--string-indentation @@ -1087,7 +1087,7 @@ ((reference-line (phps-mode-indent--get-previous-reference-command-line))) - (message "reference-line: %S" reference-line) + ;; (message "reference-line: %S" reference-line) (let ((reference-indentation (phps-mode-indent--string-indentation reference-line))) @@ -1272,7 +1272,16 @@ (setq new-indentation (phps-mode-indent--string-indentation - reference-line)))) + reference-line)) + + ;;$copies = method_exists($object, 'get_copies') + ;; ? $object->get_copies() + (when (string-match-p + "^[\t ]*$[a-zA-Z0-9_]+[\t ]*[^=!]*=\\($\\|[\t ]+.*[^,;]$\\)" + reference-line) + (setq + new-indentation + (+ new-indentation tab-width))))) ;; LINE AFTER OPENING MULTI-LINE ASSIGNMENT ;; $var = 'A line' . @@ -1283,6 +1292,7 @@ ;; or ;; $var += 35 + ;; 77 + ;; or 'data' => Object ;; but ignore ;; $var === true ;; or @@ -1297,11 +1307,15 @@ ;; or ;; $abc != 3 ((and - (string-match-p - "^[\t ]*$[a-zA-Z0-9_]+[\t ]*[^=!]*=\\($\\|[\t ]+.*[^,;]$\\)" - previous-line-string) (not - current-line-starts-with-closing-bracket)) + current-line-starts-with-closing-bracket) + (or + (string-match-p + "^[\t ]*$[a-zA-Z0-9_]+[\t ]*[^=!]*=\\($\\|[\t ]+.*[^,;]$\\)" + previous-line-string) + (string-match-p + "=>[^,;]*$" + previous-line-string))) (setq match-type 'line-after-opening-multiline-assignment) diff --git a/phps-mode-macros.el b/phps-mode-macros.el index 7d4e2550d7..c3cffb5e82 100644 --- a/phps-mode-macros.el +++ b/phps-mode-macros.el @@ -9,7 +9,7 @@ (defconst phps-mode-macrotime-debug - t + nil "Debug messages during macro expansion time, default nil.") (defmacro phps-mode-debug-message (&rest message)